Repository navigation
Description
Summary
Companion issue to #2878 (same class of bug — rtk output-filtering silently hides real failures — found and verified together; unrelated code path so filed separately).
When a project's lint script doesn't use ESLint (e.g. it's just prettier --check .) and ESLint isn't installed, the hook rewrite engine still rewrites pnpm lint → rtk lint, which defaults to ESLint, fails to resolve the binary, and prints a misleading [warn] Linter process terminated abnormally (possibly out of memory) instead of any indication that ESLint was never the right tool at all. Confirmed on rtk 0.43.0 (Homebrew, macOS arm64), reproduced both from a clean source clone and against the installed binary.
This shares its "defaults to ESLint" root cause with #665, #1489, #2094 and #2832, but the specific failure mode here — pnpm's "command not found" exit code getting reinterpreted as a signal-death/OOM warning — doesn't appear to be covered by any of them (searched for "possibly out of memory", "terminated abnormally", "254"; no matching issues).
Root cause (verified against the v0.43.0 tag, commit 5a7880d)
-
src/discover/rules.rs:153 — the rewrite rule
^(...)?(biome|eslint|lint)(\s|$)maps any command/script literally namedlinttortk lint, with"pnpm lint"listed verbatim inrewrite_prefixes(line 187). This fires regardless of what thelintscript actually runs. Confirmed via the repo's owntest_rewrite_lint(src/discover/registry.rs:2677), which asserts"pnpm lint"rewrites toSome("rtk lint")— passes on this tag (cargo test test_rewrite_lint→ ok). -
src/cmds/js/lint_cmd.rs:77-88 —
detect_linter()receives no linter name (the rewrite produced barertk lint, no args), soargs.is_empty()is true and it defaults to("eslint", false)at line 84. -
src/cmds/js/lint_cmd.rs:173-174 —
rtk lintthen runspnpm exec eslint .. When eslint isn't an installed dependency, pnpm exits 254 withERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "eslint" not found.lint_cmd'sexit_code > 128check treats this as "process killed by signal" and prints[warn] Linter process terminated abnormally (possibly out of memory)— a false and actively misleading diagnosis; nothing was killed, pnpm simply couldn't resolve the binary and exited normally with a non-zero code.
Repro (verified live against the installed rtk 0.43.0 binary)
package.json (no ESLint dependency anywhere):
{ "scripts": { "lint": "prettier --check ." }, "devDependencies": { "prettier": "^3.3.0" } }$ pnpm exec eslint .; echo "exit=$?"
undefined
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "eslint" not found
exit=254
$ rtk lint; echo "exit=$?"
[warn] Linter process terminated abnormally (possibly out of memory)
exit=254(rtk lint here stands in for what the hook produces. With the config-level workaround described below removed, rtk hook check "pnpm lint" on a stock config rewrites to exactly this, and test_rewrite_lint confirms "pnpm lint" → rtk lint is the intended stock behavior.)
An agent seeing "possibly out of memory" has no reason to suspect the real problem (wrong linter entirely) and will typically retry, chase memory/resource limits, or otherwise pursue the wrong root cause.
Environment
- rtk 0.43.0, Homebrew install, macOS arm64
- pnpm 10.22.0, Node v22.23.1, no ESLint installed, prettier 3.9.4 as the actual
lintscript
Suggested fix
Any of:
- Don't rewrite
pnpm lint/npm run lint/ etc. at all — these names point at a project-defined script body the hook can't see (also suggested as option 1 in bug: hook rewrite ofpnpm lintdiscards package.json script body — same false-green as #185 at the hook layer #2094). - Resolve the script body from
package.jsonbefore rewriting/dispatching, and only route to the ESLint adapter when it actually invokes eslint (or biome/ruff/whatever the project really uses). - At minimum, stop classifying pnpm/npm "command not found" exit codes (254 for pnpm) as
> 128signal-death — detect the specific "not found" /ERR_PNPM_RECURSIVE_EXEC_FIRST_FAILsignature and report "eslint is not installed" instead of "possibly out of memory".
Local workaround
Hook-level exclusion in config.toml (mirrors the rewrite rule in src/discover/rules.rs, not a general fix — just stops rtk intercepting anything literally named lint at the hook layer; typing rtk lint explicitly is unaffected and works fine when ESLint really is the project's linter):
[hooks]
exclude_commands = [
'^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?lint(\s|$)',
]
Activity
pszymkowiak commentedon Jul 8, 2026
🔍 Automated Triage
bughighSummary
pnpm lint hook rewrite defaults to ESLint even when the project's lint script isn't ESLint, and misclassifies pnpm's exit 254 'command not found' as a signal-death OOM warning, actively misleading agents/users about the real problem.
📁 Relevant files
src/discover/rules.rssrc/cmds/js/lint_cmd.rssrc/discover/registry.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
tianhuil commentedon Nov 17, 2026
Same on rtk 0.45.0, Linux x86_64, pnpm 10.15.0, Biome 2.6.4.
pnpm exec biome --versionis rewritten too (tortk lint --version), so even a version check prints the out-of-memory warning; it sent our agents chasing memory pressure for weeks.Workaround that also holds for chained and env-prefixed commands (
cd x && pnpm lint,FOO=1 pnpm lint), checked withrtk rewrite: