claude-code - 💡(How to fix) Fix Silent failure (exit 0, empty output) with CLAUDE_CONFIG_DIR isolation on 2.1.123+

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When running claude -p ... with CLAUDE_CONFIG_DIR set to a non-default directory, versions 2.1.123 and later silently produce empty output and exit 0 with no error. Version 2.1.91 works correctly with the same setup.

Error Message

exit 0 with no error. Version 2.1.91 works correctly with the same setup. actual chat completion. No error is printed to stdout or stderr. calls return empty. The lack of any error message makes the failure

Root Cause

When running claude -p ... with CLAUDE_CONFIG_DIR set to a non-default directory, versions 2.1.123 and later silently produce empty output and exit 0 with no error. Version 2.1.91 works correctly with the same setup.

Fix Action

Workaround

Pin to @anthropic-ai/[email protected]. This is unsustainable as it prevents access to newer features (e.g. xhigh effort level introduced in a later version).

Code Example

mkdir /tmp/isolated-config
cp ~/.claude/.credentials.json /tmp/isolated-config/.credentials.json
chmod 600 /tmp/isolated-config/.credentials.json

docker run --rm \
  -v ~/.claude:/home/node/.claude:ro \
  -v /tmp/isolated-config:/home/node/isolated-config:ro \
  -e CLAUDE_CONFIG_DIR=/home/node/isolated-config \
  --user node \
  node:24-slim sh -c '
    npm install -g @anthropic-ai/claude-code@2.1.143 >/dev/null 2>&1
    claude -p "reply only OK" --model haiku --dangerously-skip-permissions
    echo "exit=$?"
  '

---

OK
exit=0

---

(empty stdout)
exit=0
RAW_BUFFERClick to expand / collapse

Summary

When running claude -p ... with CLAUDE_CONFIG_DIR set to a non-default directory, versions 2.1.123 and later silently produce empty output and exit 0 with no error. Version 2.1.91 works correctly with the same setup.

Environment

  • Container: node:24-slim (Debian)
  • Working version: 2.1.91
  • Broken versions: 2.1.123 → 2.1.143 (latest as of 2026-05-16)

Reproduction

mkdir /tmp/isolated-config
cp ~/.claude/.credentials.json /tmp/isolated-config/.credentials.json
chmod 600 /tmp/isolated-config/.credentials.json

docker run --rm \
  -v ~/.claude:/home/node/.claude:ro \
  -v /tmp/isolated-config:/home/node/isolated-config:ro \
  -e CLAUDE_CONFIG_DIR=/home/node/isolated-config \
  --user node \
  node:24-slim sh -c '
    npm install -g @anthropic-ai/[email protected] >/dev/null 2>&1
    claude -p "reply only OK" --model haiku --dangerously-skip-permissions
    echo "exit=$?"
  '

Expected

OK
exit=0

Actual

(empty stdout)
exit=0

total_cost_usd in the streaming result event is 0, and all usage token counters are 0.

Observation

With --debug, the CLI successfully reads .credentials.json, builds an Authorization: Bearer ... header, and issues a GET to /api/oauth/profile. The process then exits without performing the actual chat completion. No error is printed to stdout or stderr.

Removing CLAUDE_CONFIG_DIR and using only the default $HOME/.claude/ path with the same credentials works correctly.

Workaround

Pin to @anthropic-ai/[email protected]. This is unsustainable as it prevents access to newer features (e.g. xhigh effort level introduced in a later version).

Impact

A 24/7 bot using CLAUDE_CONFIG_DIR to isolate its Claude session from user-scope MCP / CLAUDE.md / skills (a documented isolation strategy) is silently dead on upgrade — all chat / cron / extraction calls return empty. The lack of any error message makes the failure mode very hard to diagnose.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Silent failure (exit 0, empty output) with CLAUDE_CONFIG_DIR isolation on 2.1.123+