Engineering Runtime Errors Debugging

Investigate Runtime Errors

The error only happens for some inputs: find the implicit contract those inputs violate, with the runtime checklist as the suspect list.

Overview

Runtime errors that hit only some inputs are contract violations wearing exception costumes: somewhere, the code assumes a shape, an order, or a presence that those inputs don't deliver. This setup investigates an InvalidOperationException that fails only for certain tenants: the runtime strategy traces the failing path, the checklist walks the suspects — null paths, dependency failures, invalid state, configuration, environment drift, unchecked input contracts — and the framework demands the divergence point: what is different about the inputs that fail?

How to use this resource

  1. Characterize the failing inputs

    The investigation's first real question: what do the failing cases share that the passing ones lack?

  2. Name the violated assumption

    "Tenant created mid-month has no complete billing period" — the contract the code assumed but never checked.

  3. Fix the contract, then the code

    Decide whether the assumption should be enforced, relaxed, or handled — then the change writes itself.

Why This Works

  • Input characterization converts a mystery into a diff between datasets
  • The checklist keeps boring causes (config, drift) in view next to glamorous ones
  • Contract naming produces fixes that survive the next unusual input

Best for

  • Multi-tenant systems with data-shaped failures
  • Batch jobs that fail on specific records
  • Errors that survived one "fix" already

Not for

  • Errors that strike randomly on identical input — that's the intermittent strategy
  • Performance degradation without errors — that's the performance strategy

Use cases

  • Errors that hit some tenants, users, or files and not others
  • Exceptions whose message names the symptom, not the assumption
  • "Sequence contains no elements" and its empty-collection cousins

FAQ

Why does this debugging prompt refuse to just tell me the fix?

By design it withholds the answer until diagnosis is validated. The INVESTIGATION FRAMEWORK runs ten stages ending in FIX RECOMMENDATION, and the ROOT CAUSE RULES demand the most likely cause plus at least two alternatives, each with confirming and contradicting evidence. FIX REQUIREMENTS forbid an unexplained patch — every proposal names the cause, evidence, change, and how to verify it.

What makes this suited to errors that only hit some inputs, like some tenants?

The whole framework is built to find the divergence point. Checklist item 6 targets input that violates an implicit contract the code never checks, and the loaded case — InvalidOperationException "Sequence contains no elements" for tenants created mid-month — is exactly that. The first real move is characterizing what failing inputs share that passing ones lack.

What do FACT, ASSUMPTION, and HYPOTHESIS labels do in the output?

They keep the investigation honest about what's actually known. The EVIDENCE RULES require every statement to be tagged as one of the three: FACT is directly observed, ASSUMPTION is believed without evidence and must be verified or discarded, and HYPOTHESIS is a testable causal claim that ships with its test. You run the generated prompt and validate its claims yourself.

More resources from Debugging Prompt Generator

Resources that pair well

Related tools

Guides for this resource

Tip: Save time by exploring related resources and tools that integrate with this resource.