lancet Docs
Reference

Troubleshooting & Refusal Recovery Matrix

Concrete diagnostic and recovery procedures for every error and intentional refusal.

Every Lancet refusal returns exit code 2 with a specific diagnostic instead of silently misbehaving. Look up your exact symptom below.

Editing, Patching & Rename Refusals#

Symptom / ErrorRoot CauseExact Fix
status: "conflict" on edit / patch / renameFile bytes on disk changed since --rev was readRun lancet read <FILE> --json again, inspect the updated lines, recompute your edit, and pass the new rev.
edit --find refused (found 0 or >1 times)Literal substring does not occur uniquelyInspect line numbers listed in the error; expand surrounding context in --find, or pass --all if replacing all occurrences intentionally.
edit --symbol removed doc comments or attributes--symbol spans leading /// and #[attr] just like read --symbolInclude the doc comments and attributes in --with / --with-file, or target only the inner body with --lines.
Syntax error increase refusedEdit or patch increases Tree-sitter error countCheck the preview diff for unclosed braces or typos; pass --allow-syntax-errors only if intentionally staging an intermediate edit.
lancet rename refused (unsupported)Target is top-level/exported, field, method, Python param, macro, JSX tag, or causes shadowingSee refusal reasons; fall back to lancet refs + lancet edit --edits or your LSP.
lancet patch refuses binary or copy diffPatch includes Binary files / copy fromFilter non-binary text hunks cleanly before piping to lancet patch.

Search, AST & Traversal Errors#

Symptom / ErrorRoot CauseExact Fix
status: "invalid_query" on LQLUnknown filter, unclosed quote, or missing operatorRun lancet parse '<QUERY>' and inspect the byte offset pos in the error.
ast --rewrite --apply refuses --limitCombining --limit with --apply risks partial unreviewed mutationsRemove --limit or narrow scope explicitly with --path GLOB.
ast 'if ($C) $S' misses if ... elseLancet matches strict AST shapes (if vs if-else are distinct)Write a second pattern including the else branch if both forms are intended.
lancet rg -P failsPCRE2 lookarounds & backreferences are unsupportedRewrite using Rust regex without lookarounds, or LQL before() / NOT.
PATH: No such file or directory (exit 2 on stderr)Passed a nonexistent directory/file to fd, search, batch, refs, or ast (or typo like fd docs/imgaes)Fix the path spelling; missing paths fail explicitly instead of silently returning empty (exit 1).
lancet fd '*.md' prints stderr glob noticePattern has *, ?, or [ so Lancet automatically switches to glob mode (-g)Expected in v0.1.3+; pass -r for regex or keep -g explicitly to silence the note.

Index, Documents & MCP Issues#

Symptom / MessageRoot CauseExact Fix
Query after lancet index ignores recent edit under --trust-index--trust-index skips metadata stat checks by designRemove --trust-index to use fresh auto mode, or run lancet index . to sync.
Windows misses same-size edit with preserved mtimeRust stdlib on Windows exposes only mtime & sizeRun lancet index . or query with --no-index after tools that restore timestamps on Windows.
lancet rg misses text inside PDF / .docxlancet rg disables adapters by default for rg parityPass lancet rg --docs (or use default LQL search lancet 'query').
Scanned PDF / image yields empty textNo embedded text layer in image/PDFPass --ocr and verify pdftoppm + tesseract are installed on PATH.
MCP call fails with "this MCP server is read-only"Server started with --read-only (refuses edit, patch, rename, index, --apply)Restart lancet mcp without --read-only when edits are intended.
MIT OR Apache-2.0 · Single Rust binary View Markdown source on GitHub →