Symptom
Running any workspace alias inside a git worktree nested under the repo root (e.g. .claude/worktrees/<name>) fails:
$ cargo check-fastly
error: unexpected argument 'check' found
Every alias is affected (check-fastly, test-axum, clippy-cloudflare, ...).
Root cause
Cargo discovers .cargo/config.toml in the current directory and every ancestor directory. A worktree nested inside the repo therefore loads the file twice: the worktree's own checked-out copy and the parent checkout's copy.
Per Cargo's config-merge rules, array values are merged by concatenation, so each alias expands to doubled tokens (check -p ... check -p ...), which fails argument parsing. String values are instead overridden by the deeper config.
Fix
Convert the aliases in .cargo/config.toml from array form to string form. Cargo splits string aliases on whitespace, so behavior at the repo root is identical, and nested worktrees resolve to a single definition.
Note: string and array forms do not coexist across the nesting - a mixed pair fails with error: could not load Cargo configuration. Nested worktrees work once both the parent checkout's branch and the worktree's branch carry the fix.
Symptom
Running any workspace alias inside a git worktree nested under the repo root (e.g.
.claude/worktrees/<name>) fails:Every alias is affected (
check-fastly,test-axum,clippy-cloudflare, ...).Root cause
Cargo discovers
.cargo/config.tomlin the current directory and every ancestor directory. A worktree nested inside the repo therefore loads the file twice: the worktree's own checked-out copy and the parent checkout's copy.Per Cargo's config-merge rules, array values are merged by concatenation, so each alias expands to doubled tokens (
check -p ... check -p ...), which fails argument parsing. String values are instead overridden by the deeper config.Fix
Convert the aliases in
.cargo/config.tomlfrom array form to string form. Cargo splits string aliases on whitespace, so behavior at the repo root is identical, and nested worktrees resolve to a single definition.Note: string and array forms do not coexist across the nesting - a mixed pair fails with
error: could not load Cargo configuration. Nested worktrees work once both the parent checkout's branch and the worktree's branch carry the fix.