Intermittent Failure Investigation Plan
Build an investigation plan for a failure that happens only sometimes: what to record, what patterns to look for and which experiments to run.
When to use it
Use it for flaky tests, rare production errors and problems that disappear when you try to reproduce them. The prompt helps you decide what evidence to collect first, lists the usual causes of intermittency such as timing, shared state and environment, and proposes experiments that narrow them down.
When not to use it: Do not use it for a failure that reproduces every time: debug that directly. It cannot find the cause without evidence from your system, so it produces a plan for gathering evidence, not a diagnosis.
Required inputs
| Placeholder | What to provide | Example |
|---|---|---|
| {{failure_description}} | What fails, what the failure looks like and the exact error text if there is one. | The nightly stock-sync job fails about once a week with 'duplicate key value violates unique constraint'. |
| {{frequency_and_pattern}} | How often it happens and any pattern you have noticed or ruled out, such as time of day, load or specific data. | Roughly once a week, always in the first run after midnight. Never on weekends. Not seen locally. |
| {{system_description}} | Relevant components, concurrency, schedulers, caches, external services and environments. | Two instances of the job runner behind a scheduler; both can be triggered by a retry; Postgres database. |
| {{available_evidence}} | Logs, metrics and traces you already have, and what you cannot see. | Application logs for 30 days, no distributed tracing, no database query log. |
The prompt
Fill in each {{placeholder}} before you send it.
You are an experienced engineer helping to investigate an intermittent failure. The aim is to design the investigation, not to guess the answer.
<failure_description>
{{failure_description}}
</failure_description>
<frequency_and_pattern>
{{frequency_and_pattern}}
</frequency_and_pattern>
<system_description>
{{system_description}}
</system_description>
<available_evidence>
{{available_evidence}}
</available_evidence>
Produce:
1. What the evidence already tells us and what it does not. Separate observed facts from inferences.
2. Candidate explanation classes that fit the facts, drawn from areas such as timing and ordering, concurrent execution, shared or leaked state, resource limits, environmental or data differences, external dependency behaviour and retries. For each, say why it fits or does not fit what is known. Do not list classes that clearly do not apply.
3. Evidence to collect, in priority order: what to log or measure, where, and with what identifiers so failures can be correlated. Prefer changes that are cheap and safe to deploy.
4. Experiments: ways to make the failure more likely (increase concurrency, widen timing windows, repeat in a loop, vary data) or to isolate a factor, each with the result that would support or rule out an explanation.
5. What to do in the meantime to limit harm, without hiding the problem.
Rules:
- Do not claim a cause. You have not seen the system run. Phrase explanations as candidates and state what would confirm each.
- Use only the facts provided. Where a recommendation depends on something unknown, say what you need to know.
- Suggest changes to production only if they are low risk, reversible and listed with their risk.
- Do not recommend retrying until it passes as a fix.
Output format:
Known facts and inferences
Candidate explanations (table: class | fits because | does not fit because | what would confirm)
Evidence to collect (ordered)
Experiments
Interim safeguards
Questions for the teamExpected output
A separation of facts from inferences, a short table of candidate explanation classes tied to the stated pattern, an ordered list of evidence to add such as run identifiers and timestamps, and concrete experiments such as triggering two runs at once. For the example, concurrent runs and non-idempotent inserts should feature, with a note that this is a candidate rather than a finding.
Known facts and inferences
Fact: the error is a unique-key violation, once a week, after midnight. Inference: two writers attempt the same insert, or one writer repeats a step.
Candidate explanations
Concurrent execution | fits: two runner instances exist and a retry can start a second run | does not fit: unknown whether the retry fires at midnight | confirm: find two run ids overlapping in the logs for a failing night
Evidence to collect
1. Log a run id, instance name, start and end time and the key being inserted.
Experiments
- Start two runs together in a staging copy and see whether the same error appears.Limitations
- The plan is only as good as the system description. A missing component, such as a cache or a second scheduler, can send the investigation the wrong way.
- It cannot tell you which candidate is correct. Only evidence from your system can do that.
- Making a failure more likely in a test environment may expose a different bug from the production one. Check that the error is the same.
- Added logging in production can itself change timing or volume. Roll it out carefully.
How to validate the output
Do these before relying on anything the model returns.
- Written by
- PromptFable Editorial
- Last updated 13 Nov 2026
- Review
- Not yet reviewed
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.