Skip to content

v0.2.119 picks linux-arm64-musl variant on Debian (glibc) arm64 even when only linux-arm64 is installed #306

@LatitudeForty

Description

@LatitudeForty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions