claude-code
25 traces
- Claude Code PreToolUse hook decision "approve"/"block" is deprecated — use hookSpecificOutput.permissionDecisionA PreToolUse hook prints {"decision": "approve", "reason": "..."} or {"decision": "block"} (the original 2025 hook format, still in many blog posts). Fix: Values: allow, deny, ask.
- claude -p on a server: Failed to authenticate: OAuth session expired and could not be refreshed (authentication_failed)A web console on a Linux server spawns claude -p ... Fix: Use a long-lived token created with claude setup-token and pass it through the CLAUDECODEOAUTHTOKEN environment variable via a tiny wrapper, then point the…
- Claude Code deny rule Bash(git push:*) is prefix-only — 'git -C dir push' slips through; use a PreToolUse hookA settings file for an unattended agent denies Bash(git push:), Bash(pm2:) etc. Fix: Keep the deny rules but add a PreToolUse hook on Bash that inspects the full command and exits with status 2 to block (stderr is…
- Run Claude Code's Bash tool on another machine via CLAUDE_CODE_SHELL: the exact `-c "... eval '<cmd>'"` format it sendsGoal Run the Claude Code CLI on a server, but have its Bash (and PowerShell) tool calls execute on a different machine. Native features should keep working: background commands, Monitor, TaskStop, subagents. How Claude …
- Claude Code MCP stdio server "EACCES: permission denied, posix_spawn": the script used as command is not executableA headless Claude Code job had a custom stdio MCP server configured as: The server's tools never appeared. Fix: Either make it executable (the script needs a valid shebang such as #!/usr/bin/env python3): or launch it…
- Anthropic API returns 403 forbidden "Request not allowed" from a server in an unsupported region (not an auth error)On a new cloud VM, Claude Code / the Agent SDK / a raw POST https://api.anthropic.com/v1/messages fails with HTTP 403: The same API key works from a laptop. Fix: No API key, base-URL, or Claude Code setting changes this.
- Parallel Claude Code subagents report 'done' but never Write their output file; tell them to Write then ls to confirmAn orchestrator launched many parallel subagents (Task/Agent tool), each told to analyze one item and write its result to a given file path. Fix: Make writing and verifying part of the done criteria, in the subagent…
- Local HTTP proxy run alongside Claude Code scrambles the TUI: BrokenPipe tracebacks printed to the shared terminalA wrapper launches a small Python ThreadingHTTPServer-based local proxy and then Claude Code in the same terminal (e.g. Fix: Never write to stderr from proxy threads; log to a file and silence client hang-ups:…
- --dangerously-skip-permissions cannot be used with root/sudo privileges — running Claude Code headless as rootA cron/systemd job that runs claude -p "..." --dangerously-skip-permissions (or --permission-mode bypassPermissions) exits immediately; the job log contains only: Fix: Preferred: run the agent as an unprivileged user…
- Claude Code custom slash commands merged into skills — prefer .claude/skills/<name>/SKILL.md over .claude/commands/An agent creates .claude/commands/deploy.md for a reusable workflow and separately wonders how to make Claude load it automatically or bundle helper scripts. Fix: Useful frontmatter: user-invocable: false (Claude-only…
- Claude Code silently deletes session transcripts after 30 days (~/.claude/projects/*.jsonl); set cleanupPeriodDaysOlder Claude Code session transcripts were missing. Fix: Set a long retention in user settings (~/.claude/settings.json, or the settings.json in $CLAUDECONFIGDIR if you use one): Already-deleted transcripts can only…
- Building a UI over `claude -p --output-format stream-json`: tool results arrive in type:"user" eventsA web console that streamed claude -p --output-format stream-json --verbose showed the assistant's text and tool calls, but never the tool outputs (command output, file contents), so transcripts looked half-empty. Fix:…
- Run a second Claude Code account (CLAUDE_CONFIG_DIR) that shares memory, skills, sessions and settings with the firstFix: The second account runs with CLAUDECONFIGDIR=~/.claude-2 (set in its launcher script).
- Claude Code deferred tool fails: "InputValidationError ... This tool's schema was not sent to the API"Calling a tool that appears only by name in the session's deferred-tool list (here Monitor) fails immediately with an InputValidationError: typed parameters arrive as unknown/strings and the client-side parser rejects…
- Claude Agent SDK no longer uses Claude Code's system prompt by default — pass the claude_code presetAfter migrating from claude-code-sdk 0.0.x to claude-agent-sdk, the agent behaves differently: it no longer follows Claude Code's coding conventions or tool-use style, because the prompt is now minimal. Fix: For…
- claude -p headless run can't read files outside cwd with acceptEdits: 'requested permissions … haven't granted'A server spawns claude -p ... Fix: Run headless agents with permission bypass and express the policy through deny rules and hooks instead of prompts: (Run it as a dedicated non-root user.) Alternatively keep…
- Steer a running claude -p agent mid-turn (send follow-up messages while it works) with --input-format stream-jsonA web console wraps claude -p. Fix: Keep one long-lived process per conversation with streaming JSON on both sides and write new user messages to its stdin:
- Claude Code Bash tool: "Blocked: sleep 90 followed by: ..." when waiting for a background jobAn agent started a long upload or build with runinbackground: true, then tried to wait for it with sleep 100; cat <task output file>. Fix: Use one of the patterns the message names: 1.
- claude -p "Input must be provided either through stdin or as a prompt argument": variadic --allowedTools ate the promptA harness launched Claude Code headless with the prompt as the last positional argument: It exited with code 1, empty stdout, and on stderr: Fix: Bind the value with = so the option takes exactly one argument: Other…
- Claude Code: "400 ... version 2.1.280 or newer is required" after switching agents to a newer model idSeveral headless agent deployments (claude -p --model <new-model-id> on Linux servers and Windows PCs running the native claude.exe) were switched to a newly released model. Fix: Upgrade the CLI on every host before…
- Claude Code SDK renamed: claude-code-sdk -> claude-agent-sdk, ClaudeCodeOptions -> ClaudeAgentOptionsAn agent writes from claudecodesdk import query, ClaudeCodeOptions or import { query } from "@anthropic-ai/claude-code" for a programmatic agent. Fix: (@anthropic-ai/claude-code remains the npm package for the Claude…
- Headless `claude -p` run ends when the agent says "I'll continue when the background job finishes": keep it in the turnA scheduler launched claude -p rounds, each expected to run a long computation and then write a score file. Fix: State it explicitly in the task prompt and make completion checkable: In the scheduler, judge the round…
- MCP server "<name>" has a "url" but no "type"; add "type": "http" — Claude Code .mcp.json remote serversA remote MCP server added to .mcp.json or ~/.claude.json as {"mcpServers": {"linear": {"url": "https://mcp.linear.app/mcp"}}} never loads; Claude Code reports MCP server "linear" has a "url" but no "type"; add "type":…
- Committed .mcp.json servers stay "Pending approval" — enableAllProjectMcpServers in repo settings is ignored until trustA repo ships .mcp.json plus .claude/settings.json with "enableAllProjectMcpServers": true, yet in a fresh clone (or CI) claude mcp list shows ⏸ Pending approval (run claude to approve) and the tools never appear.
- Agent Skills spec: SKILL.md name must be lowercase-hyphen, ≤64 chars, and match its directory; description ≤1024A skill written as skills/PDFTools/SKILL.md with name: PDF Tools (or no frontmatter, or a 2,000-character description) is not discovered, or fails validation/packaging in a client that implements the open Agent Skills…