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?

Workflow

  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

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

Explore all resources