Repository navigation
Description
Environment
- RTK:
rtk 0.38.0(Windows binary,C:\Users\<user>\AppData\Local\rtk\rtk) - OS: Windows 11 Home Single Language, build 10.0.26200
- Shell used for repro: Git Bash (MSYS2),
GNU bash, version 5.2.37(1)-release (x86_64-pc-msys) - Package manager: pnpm 11.0.8
- Node: v22.21.0
- Project: Next.js repo using Biome (via Ultracite) exclusively — no ESLint installed
(node_modules/.bin/eslintabsent, no eslint config file), triggered via the
Claude CodePreToolUsehook (rtk hook claude, configured in
~/.claude/settings.jsonas{"matcher": "Bash", "hooks": [{"type": "command", "command": "rtk hook claude"}]}).
This report covers two distinct, separable bugs found while investigating the same
symptom. Both were reproduced directly against the rtk binary (not just through the
Claude Code hook), using the JSON stdin format the hook itself sends.
Bug 1 — the auto-rewrite matcher substitutes an ESLint-only filter for Biome invocations
rtk hook claude decides to rewrite a Bash command by scanning it for known keywords.
For every pattern actually tested below, a command containing biome (as its own
token, or embedded in pnpm exec biome ... / npx biome ...), or the package-script
name lint in pnpm run lint, gets rewritten to rtk lint — a subcommand documented
as "ESLint with grouped rule violations". There is no Biome-specific subcommand
(rtk biome --help reports Failed to resolve 'biome' via PATH, falling back to direct exec: Binary 'biome' not found on PATH), and no detection of which linter the
target project actually has configured before choosing the ESLint filter.
Patterns confirmed to trigger this rewrite (piping the hook's own JSON stdin format
directly into rtk hook claude):
$ echo '{"tool_name":"Bash","tool_input":{"command":"biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk lint check app/api/user/sessions/route.ts"}}}
$ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm exec biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk lint check app/api/user/sessions/route.ts"}}}
$ echo '{"tool_name":"Bash","tool_input":{"command":"npx biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk lint check app/api/user/sessions/route.ts"}}}
$ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm run lint"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk lint"}}}
(In this project, pnpm run lint is defined in package.json as
ultracite check --config-path biome.jsonc — a Biome wrapper, not ESLint.)
Patterns confirmed NOT to trigger the rewrite (untested beyond these — not a claim
about the general matching rule):
$ echo '{"tool_name":"Bash","tool_input":{"command":"node_modules/.bin/biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
(no output — command passed through unmodified)
$ echo '{"tool_name":"Bash","tool_input":{"command":"rtk proxy pnpm exec biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
(no output — command passed through unmodified)
$ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm exec ultracite check --config-path biome.jsonc"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk pnpm exec ultracite check --config-path biome.jsonc"}}}
(this last one is a generic passthrough-shaped rewrite, not the broken ESLint
substitution — ultracite as a literal token is not treated as a lint/biome
keyword.)
Consequence: for the four triggering patterns above, the real Biome/Ultracite
check is never executed. RTK substitutes its own ESLint invocation instead, in a
project that has no ESLint installed.
Bug 2 — when the substituted rtk lint call fails, the reported result is
inconsistent and can be a false pass (including exit 0)
Running rtk lint directly (bypassing the hook, to isolate this from Bug 1) shows
what happens once the substitution from Bug 1 has occurred:
$ rtk lint app/api/user/sessions/route.ts -vvv
ESLint output (JSON parse failed: expected value at line 1 column 1)
undefined
[ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL] Command "eslint" not found
$ echo $?
1
This confirms rtk lint shells out to eslint via pnpm, that ESLint is not
resolvable in this project, and that RTK's ESLint-JSON output parser fails to parse
the resulting plaintext pnpm error (JSON parse failed: expected value at line 1 column 1).
The two argument shapes actually produced by the Bug-1 rewrites behave differently
after that parse failure:
$ rtk lint check app/api/user/sessions/route.ts
Lint: No issues found
$ echo $?
1
(what biome check <file> / pnpm exec biome check <file> / npx biome check <file> become — false "No issues found" message, but the exit code does correctly
propagate as failure)
$ rtk lint
ESLint output (JSON parse failed: expected value at line 1 column 1)
undefined
[ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL] Command "eslint" not found
$ echo $?
0
(what bare pnpm run lint becomes — the raw failure text is shown, but the process
exits 0: a caller that checks only the exit code is told the check passed)
Consequence: the same underlying failure (ESLint not found → JSON parse failure)
produces two different outcomes depending on how the command reached rtk lint, and
in the pnpm run lint case the exit code itself is wrong, not just the message.
Related but separate: exclude_commands doesn't reliably opt a command out of
Bug 1's rewrite
While investigating a local workaround, adding "biome" to [hooks].exclude_commands
in config.toml was found to stop the rewrite only when biome is the first token of
the command:
$ rtk config | grep -A1 biome
"biome",
]
$ echo '{"tool_name":"Bash","tool_input":{"command":"biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
(no output — correctly not rewritten)
$ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm exec biome check app/api/user/sessions/route.ts"}}' | rtk hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecisionReason":"RTK auto-rewrite","updatedInput":{"command":"rtk lint check app/api/user/sessions/route.ts"}}}
(still rewritten — exclude_commands did not apply)
The rewrite matcher (Bug 1) scans the whole command string, but exclude_commands
appears to check only argv[0]. This means exclude_commands cannot be used to
reliably protect a tool that's normally invoked via pnpm exec/npx/a package
script, which is the common case for biome. (This config change was reverted after
testing — it offered only partial protection and is a global, per-developer setting
that would have affected other, ESLint-using projects.)
Suggested fixes
- Before routing a
lint/biome-keyword command to the ESLint filter, detect what
the target project actually has configured (presence ofbiome.json(c)vs an
ESLint config /eslintresolvable innode_modules/.bin), or add a first-class
Biome filter (rtk biome, analogous tortk prettier/rtk ruff) and route to it
instead when Biome is what's present. - When the underlying linter process fails to spawn/resolve (as opposed to running
and reporting zero violations), that should be surfaced as an execution error —
non-zero exit, clear "underlying linter not found/failed to run" message — every
time, regardless of which argument shape reached the parser. It should never look
the same as a clean pass. - Make
exclude_commandsmatching consistent with the rewrite matcher (both
argv[0]-only, or both whole-string) so it can reliably opt outpnpm exec <tool>,
npx <tool>, andpnpm run <script-that-wraps-tool>forms, not just the bare
<tool> ...form.
This is reported as a correctness/reliability bug — the tool changes what actually
runs and what result is reported, silently, without exposing this in its own output.
Activity
pszymkowiak commentedon Jul 21, 2026
🔍 Automated Triage
bughighSummary
rtk hook claude misidentifies Biome-only projects as ESLint (rewriting biome/pnpm run lint invocations to
rtk lint), and the resulting ESLint spawn failure is inconsistently reported — sometimes a false 'No issues found', sometimes exit 0 on outright failure — masking real lint status; exclude_commands also fails to protect non-argv0 invocations.📁 Relevant files
src/hooks/claude.rssrc/commands/lint.rssrc/config.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
MannXo commentedon Jul 21, 2026
I'd like to give this a shot if it's unassigned.
fix(lint): add first-class Biome support to rtk lint (rtk-ai#3117)
fix(lint): add first-class Biome support to rtk lint (rtk-ai#3117)
fix(lint): add first-class Biome support to rtk lint (rtk-ai#3117)
noctua84 commentedon Sep 7, 2026
Two data points from hitting this today, both verified directly.
1. Still reproduces on rtk 0.43.0.
This was filed against 0.38.0 (and #1489 against 0.37.2), so the behaviour has survived several releases. Same environment as the report: Windows 11, Git Bash, Claude Code
PreToolUsehook (rtk hook claude), a Biome-only project with no ESLint installed or configured anywhere in the tree.Note the second one: an explicit
biomeinvocation is also routed to the ESLint filter, not just thenpm run lintalias.2. Project-local
.rtk/filters.tomlcannot be used to scope a workaround.Worth recording so the next person doesn't repeat the experiment.
filters.tomlsays "Project-local.rtk/filters.tomltakes precedence over these", which reads like it could override the routing per project. It cannot — it filters the output of rtk subcommands, and the hook's command rewrite happens before any filter applies.Verified with a project-local filter present and
rtk trusted, run from inside that directory:So the only available lever today is the global
[hooks] exclude_commands, which cannot be scoped to a single project.Workaround, for anyone landing here meanwhile — in
config.toml:Entries match the start of the command rather than a substring (cf. #1919, #3838), so each invocation form needs its own entry —
"biome"alone does not stopnpx biome check. With those three in place,npm run lintreturns Biome's real output and, importantly, exits 1 on an actual lint failure instead of 0.The exit-code half seems the more dangerous of the two bugs: an agent or CI step reading only the status code sees a passing lint on a failing tree, independent of which linter is involved.
fix(lint): route and filter Biome end to end
xiechimon commentedon Sep 29, 2026
Additional data point on
rtk 0.50.0(still present, and the failure mode has gotten worse than #1489 reported): the swallowed parse failure now also inverts the exit code, so a passing tree reports a lint failure.Environment
0.50.0(Homebrew,/opt/homebrew/bin/rtk), macOS 26.7 arm64PreToolUsehookrtk hook claude12.5.1workspace (pnpm-workspace.yaml), Biome2.5.14, no ESLint in the projectpackage.json:"lint": "biome ci ."Repro
Native run (no hook) — tree is clean, only warnings:
Same command through the Claude Code hook:
Real biome output is discarded entirely and the exit code flips
0 → 1.Why this matters more than a cosmetic mislabel
The rewritten path is the only path an agent using Claude Code sees, while CI and pre-commit hooks (which do not go through the LLM hook) run natively. Result: local "red" vs CI "green" on the same commit — an agent reading its own Bash output concludes the lint gate fails, and can spend a turn "fixing" a passing tree. This is the masking case in #3117/#1489, but in the false-failure direction rather than the false-pass direction #1489 observed (
process exit 0).Workaround that works on 0.50.0
[hooks] exclude_commandsin the rtk config, anchored:Verified:
rtk rewrite "pnpm lint"then exits 1 (no rewrite),pnpm lintreturns the real output and exit 0.Suggested fixes (in rough priority order)
--reporter=json, orbiome ci) when the resolved linter is Biome rather than running the ESLint adapter; the rewrite table currently mapsbiome/pnpm lint/pnpm exec biomeontortk lintregardless of the project's linter (also covered by bug(rewrite): npm run lint forced into rtk lint on Biome projects #1489, bug(hook):pnpm exec biome ci .→rtk lint ci .drops the explicitbiomename and runscias the linter (exit 254 misreported as "possibly out of memory") #2906).ESLint output (...), which sends debugging in the wrong direction.Cross-refs: #1489 (same symptom string, exit 0 at the time), #2906 (
pnpm exec biome ci .→rtk lint ci .), #3117 (umbrella).