# Troubleshooting

> The errors you are most likely to meet when installing, recording and replaying, what each one means, and how to fix it. Messages are quoted as the CLI and SDKs print them.

Find the message you see, or the closest one. If a verdict surprised you rather than an error, see [Verdicts](https://www.thekavachlabs.com/docs/reference/verdicts) first: it explains what each verdict means and what to do next.

## Installing

**`kavach: command not found` after installing.** The installer puts the binaries in `/usr/local/bin` when it can write there, and otherwise in `~/.local/bin`. Add that directory to your `PATH`, or choose the directory yourself:

```bash
curl -fsSL https://www.thekavachlabs.com/install.sh | KAVACH_INSTALL_DIR="$HOME/bin" sh
```

**`SHA-256 mismatch for …`, or `checksum for … not found in SHA256SUMS`.** The download was cut short or altered. The installer stops rather than install it. Run it again; if it keeps failing, report it.

## Recording

**`kavach-recorder not found (set Options.RecorderCommand, $KAVACH_RECORDER or put it on PATH)`**
The SDK starts the recorder as a separate process and could not find it. The installer puts `kavach-recorder` next to `kavach`. In a container, copy it into the image too, or point `KAVACH_RECORDER` at it.

**`kavach: no gateway configured`**
The handler called `env.query`, but the recorder was opened without a gateway: the function that performs the real call and whose answer is recorded (`Options.Gateway` in Go). Pass one when you open the recorder; see your [SDK's page](https://www.thekavachlabs.com/docs/sdks). The failed call is still recorded, as an error.

**No `.kavach` file appears after a crash.** Check that the recorder started (it runs as a child process of the service; an error starting it is returned when you open the recorder), and that the directory it writes to is writable. Only failures inside a step are incidents: code that panics outside the SDK's step call is not part of any step.

## Replaying

**`no host command: pass --bin or set KAVACH_BIN`**
Replay runs your own build and needs the command that starts it. Pass `--bin`, or set `KAVACH_BIN`. See [Host command](https://www.thekavachlabs.com/docs/concepts#host-command).

**`host exited before ready (…); does the command act as a host when run with kavach-host?`**
Kavach ran your command with `kavach-host` as the last argument, and the program exited instead of serving replay. Usually the program does not hand that argument to the SDK, or it parses its arguments first and rejects the unknown one. The text in the parentheses is the exit status and the end of the program's standard error.

**`host did not send ready within 10s`**
The program started but did not begin serving replay within ten seconds. Look for start-up work that runs before the SDK takes over: connecting to a database, loading a large model, waiting for a lock. In replay mode none of that is needed; skip it when the last argument is `kavach-host`.

**`host wrote a line that is not a protocol message: …`**
In replay mode, standard output belongs to the replay protocol. Something in the program printed to standard output. Send logs to standard error instead.

**`host speaks protocol N, want 1`**
The SDK in your build and the `kavach` CLI are from incompatible releases. Upgrade both to the same release.

**`journal: unsupported format version X.Y, this reader implements A.B`**
The fixture was written by a newer recorder than your CLI. Upgrade `kavach`. Before 1.0, the format can change between minor versions.

**`kavach: fixture starts from a snapshot but the handler does not implement Snapshotter`**
The fixture was cut from a snapshot, so replay must restore state before the first input. Implement `snapshot()` and `restore()` in the handler, or record without snapshots. See [Snapshot](https://www.thekavachlabs.com/docs/concepts#snapshot).

**`nondeterministic@N` on a build you did not change.** The handler read something Kavach did not record: the language's own clock, random generator, or a network call made directly instead of through `env`. Route the read through `env` and record again. See [Handler and step](https://www.thekavachlabs.com/docs/concepts#handler-and-step).

**`diverged` on a build you did not change.** The replayed environment differs from the recorded one in a way the handler sees, such as a flag passed on the command line that changes behaviour. `kavach inspect incident.kavach --full` prints the recorded `environment` record (runtime version, build revision, flags); compare it with how you started the host. Choose builds with a flag or different code, never an environment variable.

## Common questions

**Does replay touch my database, broker or network?** No. Every read is answered from the fixture, and every effect is captured instead of delivered. See [Replay](https://www.thekavachlabs.com/docs/concepts#replay).

**Do I need to change my service to use Kavach?** Yes, a little. Kavach replays code that reads the outside world through the SDK's `env`. How much changes depends on how the service is structured; [Instrument a service](https://www.thekavachlabs.com/docs/guides/instrument-a-service) walks through it. Without an SDK at all, see [No SDK](https://www.thekavachlabs.com/docs/sdks/no-sdk).

**Which languages are supported?** Go, Python, TypeScript and JavaScript, Rust, Java, C and C++, Ruby, PHP, Elixir, Haskell, OCaml and Julia. See [SDKs](https://www.thekavachlabs.com/docs/sdks). Any other language can speak the host protocol directly.

**Is it open source?** The CLI, recorder and SDKs are Apache 2.0. [Kavach Enterprise](https://www.thekavachlabs.com/docs/enterprise), which runs the loop across a production fleet, is not.

**Where do I report a bug?** On [GitHub](https://github.com/kavachlabs/kavach/issues). Attach the fixture if you can share it, and the output of the failing command with `--json`.

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