# Verdicts

> Every verdict kavach replay, diff and contract check can print, what it means, and what to do next.

Kavach ends every check with one verdict. Report verdicts exactly as printed: `unverified` is not `fixed`, and `variant_failed(3)@15` is not "mostly works".

In a verdict, `N` is the `seq` of an input (the step that input started), `K` is a variant number, and `X` is an invariant name.

## Replay and fix verification

From `kavach replay` and `kavach diff`.

| Verdict | Meaning | What to do |
| --- | --- | --- |
| `fixed` | The recorded failure is gone, invariants hold, earlier steps match production, and every variant passes. | Done. |
| `ok` | The fixture recorded no failure and replay matched. | Nothing to fix. |
| `still_failing@N` | The step of input `N` panicked or returned an error. | Keep working. On the old build, this is the reproduction you want before you start. |
| `variant_failed(K)@N` | The recorded incident passes, but variant `K` still fails at its input `N`. | The fix is too narrow. Replay the saved variant (`variants.checks[].file`) and generalise. |
| `regressed(K)@N` | The incident and its variants pass, but on regression variant `K` the new build's outputs at input `N` differ from the old build's, or it failed. | The fix changed behaviour on an input like the failing one that used to work. Replay the saved variant (`regressions.checks[].file`) on both builds with `--json` and check which output the spec calls for. |
| `unverified` | The recorded incident passes, but fewer than the required number of variants (default 10) reproduce it on the old build. | Report it; do not claim the fix is verified. |
| `invariant_violated(X)@N` | Declared invariant `X` broke after input `N`. | The change corrupted state. |
| `diverged@N` | A step before the failure produced different outputs from production. | The change altered behaviour it should not have. |
| `nondeterministic@N` | The handler read time or randomness differently from the recording. | Read time and randomness only through `env`, in the same order. |

From `diff`, `still_failing`, `invariant_violated`, `diverged` and `nondeterministic` refer to the recorded fixture; on a replayed variant they refer to the variant.

## Feature contracts

From `kavach contract check`.

| Verdict | Meaning | What to do |
| --- | --- | --- |
| `pass` | Approved contract; no regressions; every feature step changed; invariants hold on the traffic and on every feature variant. | Report the changed steps. |
| `regression@N` | Step `N` is not a feature step, and its outputs changed. | Fix it, or say why the contract should mark it. |
| `unreached@N` | Feature step `N` produced the old build's outputs. | The feature is not wired in for that input. Expected when checking the old build against itself. |
| `variant_failed(K)@N` | A variant of a feature step broke an invariant or failed. | Replay the saved variant and generalise. |
| `missing_invariant(X)` | The build does not declare invariant `X`. | Declare it as the spec states it. |
| `baseline_mismatch(V)` | `--old` does not replay the traffic. | Wrong old build, or the traffic is not from it. |
| `unapproved` | The build meets the contract, but no one approved it. | Ask the person to run `kavach contract approve`. |
| `stale_lock` | The build meets the contract, but the contract changed since it was approved. | Ask the person. |

`still_failing@N`, `invariant_violated(X)@N` and `nondeterministic@N` can also come from `contract check`, with the same meaning as above.

## Failure markers

What a fixture records about how a step failed, shown by `kavach inspect`:

| Marker | Written when |
| --- | --- |
| `panic` | The handler panicked or threw. |
| `error` | The handler returned an error. |
| `invariant` | The step ended ok but an invariant failed. |
| `crash` | The process died mid-step; written by the recorder, which saw the pipe close. |
| `dropped` | The SDK dropped records rather than wait for a full pipe. Records after it cannot be replayed until the next snapshot. |

## Exit codes

`0` for `ok`, `fixed` or `pass`; `1` for any other verdict; `2` for usage errors; `3` when a fixture or binary cannot be used. Over MCP, a verdict that is not a pass is a normal tool result; `isError` is set only when a tool could not run.

Source: https://www.thekavachlabs.com/docs/reference/verdicts
