Skip to content

bug(hook): pnpm exec biome ci . → rtk lint ci . drops the explicit biome name and runs ci as the linter (exit 254 misreported as "possibly out of memory") #2906

Closed as duplicate

Description

@shuuheyhey

Summary

The hook rewrite strips pnpm exec biome as a prefix, so the explicitly-named linter is thrown away and the linter's first subcommand becomes the linter name:

$ rtk hook check "pnpm exec biome ci ."
rtk lint ci .

rtk lint ci . then runs pnpm exec ci ., which doesn't exist, exits 254, and is reported as [warn] Linter process terminated abnormally (possibly out of memory).

biome ci . is Biome's own documented CI entrypoint (https://biomejs.dev/reference/cli/#biome-ci), so every Biome project whose lint script is biome ci . hits this.

This is a different trigger from #2879 (bare pnpm lint → no args → ESLint default). Here the user explicitly names biome on the command line and rtk still doesn't route to the Biome adapter. Related but not the same: #2879, #1489, #2540, #665. Searched "pnpm exec biome" and detect_linter — no existing issue covers this path.

Repro

Project with Biome and no ESLint, "lint": "biome ci .":

$ rtk hook check "pnpm exec biome ci ."
rtk lint ci .

$ rtk hook check "pnpm exec biome --version"
rtk lint --version

$ pnpm exec biome ci .            # via the Claude Code PreToolUse hook (`rtk hook claude`)
[warn] Linter process terminated abnormally (possibly out of memory)
exit=254

$ pnpm exec biome --version
[warn] Linter process terminated abnormally (possibly out of memory)
exit=254

Both are healthy commands. Bypassing rtk proves it:

$ rtk proxy pnpm exec biome ci . ; echo "exit=$?"
exit=0

$ ./node_modules/.bin/biome --version
Version: 2.4.16

$ /usr/bin/time -l ./node_modules/.bin/biome ci .
        0.21 real         1.09 user         0.53 sys
        98369536  maximum resident set size      # 98 MB on a 128 GB machine

rtk lint names the bogus linter out loud under -v:

$ rtk -v lint ci .
Running: ci with structured output
[warn] Linter process terminated abnormally (possibly out of memory)

$ pnpm exec ci .
undefined
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "ci" not found
exit=254

Root cause (verified against tag v0.43.0)

  1. src/discover/rules.rs:153 — the rule ^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?(biome|eslint|lint)(\s|$) maps to rtk_cmd: "rtk lint" (L154), and "pnpm exec biome" is listed verbatim in rewrite_prefixes (L185). Because the whole matched span — including the linter name — is consumed as a prefix, pnpm exec biome ci . becomes rtk lint ci .. The information that the user asked for biome is gone by the time rtk lint starts.

  2. src/cmds/js/lint_cmd.rs:77-88 — detect_linter(["ci", "."]):

    let is_path_or_flag = args.is_empty()
        || args[0].starts_with('-')
        || args[0].contains('/')
        || args[0].contains('.');
    
    if is_path_or_flag { ("eslint", false) } else { (&args[0], true) }

    "ci" has no -, / or ., so it is taken as an explicitly specified linter named ci and rtk runs pnpm exec ci ..

    (For pnpm exec biome --version → rtk lint --version, args[0] starts with -, so it falls to the ("eslint", false) default and runs ESLint instead — the bug: pnpm lint hook rewrite defaults to ESLint; "command not found" (exit 254) misreported as "possibly out of memory" #2879 shape.)

  3. src/cmds/js/lint_cmd.rs:173-174 — pnpm's "command not found" exit code is 254, and exit_code > 128 is treated as death-by-signal:

    if !result.success() && result.exit_code > 128 {
        eprintln!("[warn] Linter process terminated abnormally (possibly out of memory)");

    Nothing was killed and nothing ran out of memory. (Same misclassification as bug: pnpm lint hook rewrite defaults to ESLint; "command not found" (exit 254) misreported as "possibly out of memory" #2879 step 3.)

Why this is costly for agents

The message names a resource problem, so an LLM agent chases memory. In our repo this cost real time: an agent concluded pnpm exec biome ci . OOMs on this machine and recorded RAYON_NUM_THREADS=2 as the fix. That workaround does nothing — the env prefix is preserved through the rewrite and the rewrite still fires:

$ rtk hook check "RAYON_NUM_THREADS=2 pnpm exec biome ci ."
RAYON_NUM_THREADS=2 rtk lint ci .

$ RAYON_NUM_THREADS=2 pnpm exec biome ci . ; echo "exit=$?"
[warn] Linter process terminated abnormally (possibly out of memory)
exit=254

The real Biome run takes 0.21 s and 98 MB.

Suggested fix

Any of, ideally 1 + 3:

  1. Keep the linter name. When the rule matched biome/eslint explicitly, pass it through: pnpm exec biome ci . → rtk lint biome ci . (or dispatch straight to the Biome adapter). Only the bare lint script name should be ambiguous.
  2. Never guess from args[0]. detect_linter should match args[0] against the known linter set rather than accepting any bare word as a linter — ci, check, format are Biome/other subcommands, not linters.
  3. Stop reporting 254 as OOM. Detect pnpm's ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL / Command "X" not found and say X is not installed (or fall back to passthrough). A > 128 check is not a valid signal-death test for pnpm/npm wrappers.

Given #665, #1489, #2094, #2540, #2832 and #2879 all stem from "the lint rewrite guesses the linter", the durable fix is probably (1)+(2): never dispatch to a linter that the command line didn't actually name.

Environment

  • rtk 0.42.4 (Homebrew, macOS 26.5.1 arm64) — behaviour observed; source read and line-referenced at tag v0.43.0, where the code is unchanged
  • pnpm 10.33.2, Node v25.8.1, Biome 2.4.16, no ESLint anywhere in the dependency tree
  • lint script: biome ci .

Activity

  1. added
    bug
    help wanted
    on Jul 9, 2026
  2. pszymkowiak commented on Jul 9, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 92%

    Summary

    Hook rewrite strips the explicit 'biome' name from 'pnpm exec biome ci .', causing detect_linter to misread 'ci' as the linter and pnpm to fail with exit 254, which is then misreported as an OOM; fix rewrite_prefixes/detect_linter in rules.rs and lint_cmd.rs to preserve the named linter and stop treating exit>128 as signal death.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/discover/rules.rs
    • src/cmds/js/lint_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. daniswhoiam commented on Jul 13, 2026

    @daniswhoiam

    Corroborating on rtk 0.43.0 (homebrew) / macOS 25.3, with a variant that's arguably worse than the exit-254 case: in a workspace where both Biome and ESLint are installed (Biome 1.9.4 as the active linter, [email protected] still present as a dormant devDep), the same rewrite produces silent wrong-tool output instead of a loud failure:

    # via the Claude Code PreToolUse hook (`rtk hook claude`)
    $ pnpm exec biome --version
    v8.57.1        # ← that's ESLint's version; Biome is 1.9.4
    
    $ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm exec biome --version"}}' | rtk hook claude
    ... "updatedInput":{"command":"rtk lint --version"} ...
    
    $ echo '{"tool_name":"Bash","tool_input":{"command":"pnpm exec biome lint ."}}' | rtk hook claude
    ... "updatedInput":{"command":"rtk lint lint ."} ...

    Because rtk lint's auto-detection then picks ESLint, an agent (or human) gets plausible-looking output from the wrong linter — in our case a failing pnpm lint script chain once rendered as a tidy eslint-style rule summary, masking the real failure (the #2540 symptom, reached via this issue's rewrite path).

    Both non-hook paths behave correctly on the same machine/cwd, so the defect is isolated to the hook rewrite:

    $ rtk pnpm exec biome --version
    Version: 1.9.4
    $ rtk proxy pnpm exec biome --version
    Version: 1.9.4

    Expected behavior from our side: when the user explicitly names the tool (pnpm exec biome …), the rewrite should either route to the Biome adapter or pass the command through untouched — never a generic rtk lint dispatch that can bind to a different linter.

  4. lntutor commented on Jul 20, 2026

    @lntutor
    Contributor

    I am working on this against current develop. I will preserve explicit Biome/ESLint names through rewrite, restrict lint auto-detection to known linter names, stop treating pnpm exit 254 as a signal/OOM, and cover the reported ci and --version paths.

  5. alexisLefebvre commented on Jul 23, 2026

    @alexisLefebvre

    Until the rewrite fix lands, there's a config-only workaround via [hooks] exclude_commands in ~/.config/rtk/config.toml — but the intuitive value does not work, so it's worth spelling out.

    exclude_commands matches the command's leading token, not a substring. The failing invocations are launched through pnpm (pnpm exec biome …, pnpm biome …), whose leading token is pnpm, so:

    [hooks]
    exclude_commands = ["biome"]   # ← no effect: leading token is `pnpm`, not `biome`

    still gets rewritten and still crashes. What actually works is excluding the launcher:

    [hooks]
    exclude_commands = ["pnpm"]

    Verified on Linux (Debian glibc 2.41, rtk / Biome 2.3.14, lint = biome check), same 254 / "possibly out of memory" symptom via the Claude Code PreToolUse hook:

    $ rtk rewrite "pnpm exec biome check ."
    rtk lint check .                 # before: rewritten → crashes, exit 254
    
    # after adding exclude_commands = ["pnpm"]
    $ rtk rewrite "pnpm exec biome check ."
    (exit 1, no rewrite)
    $ pnpm exec biome check .
    Checked N files. No fixes applied.   # exit 0

    Trade-off: this disables rtk's output compaction for every pnpm … command (typecheck, build, test, …), not just biome — a blunt instrument, but it stops the false-OOM crashes without rtk proxy on each call. rtk proxy pnpm exec biome … remains the per-call escape hatch for anyone who wants to keep compaction on other pnpm commands.

    (Flagging the ["biome"]-doesn't-work gotcha specifically because it's the natural first guess and silently fails.)

    🤖 Generated with Claude Code

  6. MbBrainz commented on Sep 29, 2026

    @MbBrainz

    For those of you (and your agents) that still have this issue: I recommend setting exclude_commands = ["biome"] in the rtk config.toml Easiest workaround for as long as this issue stays unsolved.

  7. KuSh commented on Oct 3, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #3117, which tracks the same problem: an explicit pnpm exec biome <sub> or npx biome <sub> is rewritten to rtk lint <sub> and the Biome subcommand is lost. #3117 also covers pnpm run lint and the masked failures, so please follow up there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibughelp wantedpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions