# Troubleshooting
## No records appear in `stats` / `tail`
- **Wrong database path.** Every command must use the same `--db`. The default is `~/.mcpspy/telemetry.db`; check that `~` was expanded (it is, by the CLI). Run `mcpspy --db <PATH> tail` against the exact file the wrapper used.
- **Calls without an `id`.** JSON-RPC notifications have no `id` and are deliberately not recorded. Only requests with a string or numeric `id` are correlated.
- **Time window too narrow.** `stats` defaults to `--since 24h`. Older records are still in the database; widen the window, for example `--since 7d`.
- **Responses never arrived.** A record is written when the response matches its pending request. If the child never replies, nothing is stored.
## Duplicate responses from the child
Earlier versions forwarded each request line twice. The current proxy performs exactly one `write_all` per line. If you still see duplicates, verify you are not wrapping an already-wrapped command — check the MCP config for nested `mcpspy wrap ... -- mcpspy wrap ...`.
## Child appears to hang
The proxy forwards child `stderr` to host `stderr`, so a child writing logs cannot fill the pipe and block. If a child never exits, confirm it reads stdin to EOF: the proxy closes the child's stdin when the host's stdin closes.
## `stdout` contains non-JSON lines
Nothing in `wrap` mode should write banners or logs to `stdout`. Check that no wrapper around `mcpspy` prints to stdout, and that `RUST_LOG` diagnostics appear on stderr (tracing is explicitly writer-bound to stderr). In an MCP host, inspect the raw server stderr log.
## `SQLITE_BUSY` errors
The store uses WAL mode with a 5-second busy timeout, so concurrent wrapped servers should coexist. If contention persists, point each server at a distinct `--db` file, or reduce write pressure with `--no-payloads`.
## Secrets in stored previews
Redaction covers Bearer tokens, `sk-...`, `ghp_...`, `AKIA...`, generic `key=`/`password=`/`token=` values, and DB connection URLs. Error messages from JSON-RPC `error` objects are redacted too. If your secret format is not covered, either add a pattern to `Redactor::new()` or run the wrapper with `--no-payloads` to store metadata only. Never paste real secrets into bug reports.
## `init` did not change my config
- The config must be valid JSON containing a `mcpServers` or `mcp` object.
- Servers already invoking `mcpspy` are skipped by design (idempotence).
- A backup is written as `<CONFIG_FILE>.bak` before any change; restore it if the rewrite is not what you wanted.
## `top` fails immediately
`mcpspy top` needs a TTY and the default `tui` feature. A binary built with `--no-default-features` reports that the command requires `tui`. Run it in an interactive terminal, not through a pipe.
## `mcp` server does not answer
The rmcp server waits for a JSON-RPC `initialize` request before it begins serving. Send `initialize` first, then `tools/list` or `tools/call`. A terminal with no protocol input will appear idle by design.
## Build or CI failures
- Formatting and lint checks require `rustfmt` and `clippy` components (`rustup component add rustfmt clippy`).
- The `cargo publish --dry-run` check verifies package metadata and compilation without uploading.
- Feature-gated code is checked with `cargo check --no-default-features --features mcp`.