Summary
On node:22-slim (Debian 12 bookworm, aarch64, GLIBC 2.36), running query() from @anthropic-ai/claude-agent-sdk@0.2.119 fails immediately with:
Error: Container exited with code 1: /app/node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/claude. Please ensure Claude Code is installed via native installer or specify a valid path with...
The musl variant was never installed — npm correctly resolved linux-arm64. The runtime variant-resolution logic in the SDK appears to misdetect libc on Debian arm64 and request the musl binary that isn't on disk. Looks like a regression from the v0.2.113 native-binary refactor.
@anthropic-ai/claude-agent-sdk@0.2.76 (pre-0.2.113 native-binary refactor) runs fine in the identical image.
Reproduction
docker run --rm node:22-slim sh -c '
mkdir /tmp/p && cd /tmp/p &&
echo "{\"name\":\"p\",\"version\":\"1.0\",\"dependencies\":{\"@anthropic-ai/claude-agent-sdk\":\"^0.2.119\"}}" > package.json &&
npm install 2>&1 | tail -3 &&
echo --- &&
ls -d node_modules/@anthropic-ai/claude-agent-sdk-* &&
echo --- &&
uname -m &&
ldd --version | head -1
'
Output:
added N packages, and audited N+1 packages in Ns
---
node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64
---
aarch64
ldd (Debian GLIBC 2.36-9+deb12u13) 2.36
Then call query({ prompt: '...', options: { systemPrompt: { type: 'preset', preset: 'claude_code' } } }) from a script inside the same container — process exits with the error above pointing at the missing musl variant.
Diagnostic — npm install resolves correctly; runtime selector does not
| Environment |
Variant npm picks at install time |
| macOS arm64 host (M-series) |
claude-agent-sdk-darwin-arm64 ✓ |
node:22-slim arm64 (Debian 12 bookworm, GLIBC 2.36) |
claude-agent-sdk-linux-arm64 ✓ |
So npm's optionalDependencies platform matching does the right thing. The bug is in the SDK's runtime variant-selector — it chooses linux-arm64-musl despite only linux-arm64 being installed on a glibc system.
Workaround attempt
About to try pathToClaudeCodeExecutable (sdk.d.ts:1438) pointed at the globally-installed @anthropic-ai/claude-code binary in the same image. Will follow up here if/when it bypasses the broken auto-detection.
Environment
- SDK:
@anthropic-ai/claude-agent-sdk@0.2.119
- Base image:
node:22-slim (Debian 12 bookworm)
- Arch:
aarch64 (arm64)
- libc: GLIBC 2.36
- Node: v22
- npm: 10.9.7
- Last known good:
@anthropic-ai/claude-agent-sdk@0.2.76
Summary
On
node:22-slim(Debian 12 bookworm, aarch64, GLIBC 2.36), runningquery()from@anthropic-ai/claude-agent-sdk@0.2.119fails immediately with:The musl variant was never installed — npm correctly resolved
linux-arm64. The runtime variant-resolution logic in the SDK appears to misdetect libc on Debian arm64 and request the musl binary that isn't on disk. Looks like a regression from the v0.2.113 native-binary refactor.@anthropic-ai/claude-agent-sdk@0.2.76(pre-0.2.113 native-binary refactor) runs fine in the identical image.Reproduction
Output:
Then call
query({ prompt: '...', options: { systemPrompt: { type: 'preset', preset: 'claude_code' } } })from a script inside the same container — process exits with the error above pointing at the missing musl variant.Diagnostic — npm install resolves correctly; runtime selector does not
claude-agent-sdk-darwin-arm64✓node:22-slimarm64 (Debian 12 bookworm, GLIBC 2.36)claude-agent-sdk-linux-arm64✓So npm's
optionalDependenciesplatform matching does the right thing. The bug is in the SDK's runtime variant-selector — it chooseslinux-arm64-musldespite onlylinux-arm64being installed on a glibc system.Workaround attempt
About to try
pathToClaudeCodeExecutable(sdk.d.ts:1438) pointed at the globally-installed@anthropic-ai/claude-codebinary in the same image. Will follow up here if/when it bypasses the broken auto-detection.Environment
@anthropic-ai/claude-agent-sdk@0.2.119node:22-slim(Debian 12 bookworm)aarch64(arm64)@anthropic-ai/claude-agent-sdk@0.2.76