Skip to content

Commit a4b0bc0

Browse files
committed
docs: add detailed comments explaining environment inheritance for Claude CLI auth
1 parent f877670 commit a4b0bc0

File tree

1 file changed

+4
-2
lines changed
  • src/integrations/claude-code

1 file changed

+4
-2
lines changed

src/integrations/claude-code/run.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ function runProcess({
191191
process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS ||
192192
CLAUDE_CODE_DEFAULT_MAX_OUTPUT_TOKENS.toString(),
193193
},
194-
// Inherit the shell environment to ensure authentication tokens are available
194+
// IMPORTANT: These options are critical for Claude CLI authentication
195+
// extendEnv: true - Inherits parent process environment variables including ANTHROPIC_API_KEY
196+
// shell: true - Ensures proper environment variable expansion for authentication tokens
197+
// Without these, Claude CLI fails with "Invalid API key" even when properly authenticated
195198
extendEnv: true,
196-
// Use shell to ensure proper environment variable expansion
197199
shell: true,
198200
cwd,
199201
maxBuffer: 1024 * 1024 * 1000,

0 commit comments

Comments
 (0)