[BUG] 403 after a few turns on one specific machine
Resolved 💬 2 comments Opened Jan 13, 2026 by nshkrdotcom Closed Feb 26, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Consistently getting 403'ed after a few turns on this one machine.
What Should Happen?
shouldnt log me out
Error Messages/Logs
cat /home/home/.claude/debug/f0f841bd-e89e-4665-9114-8d8fa55a8f30.txt
2026-01-13T04:38:05.109Z [DEBUG] [init] configureGlobalMTLS starting
2026-01-13T04:38:05.109Z [DEBUG] [init] configureGlobalMTLS complete
2026-01-13T04:38:05.109Z [DEBUG] [init] configureGlobalAgents starting
2026-01-13T04:38:05.109Z [DEBUG] [init] configureGlobalAgents complete
2026-01-13T04:38:05.112Z [DEBUG] [LSP MANAGER] initializeLspServerManager() called
2026-01-13T04:38:05.112Z [DEBUG] [LSP MANAGER] Created manager instance, state=pending
2026-01-13T04:38:05.112Z [DEBUG] [LSP MANAGER] Starting async initialization (generation 1)
2026-01-13T04:38:05.112Z [DEBUG] [STARTUP] Loading MCP configs...
2026-01-13T04:38:05.113Z [DEBUG] Found 0 plugins (0 enabled, 0 disabled)
2026-01-13T04:38:05.113Z [DEBUG] Total LSP servers loaded: 0
2026-01-13T04:38:05.113Z [DEBUG] [LSP SERVER MANAGER] getAllLspServers returned 0 server(s)
2026-01-13T04:38:05.113Z [DEBUG] LSP manager initialized with 0 servers
2026-01-13T04:38:05.113Z [DEBUG] [STARTUP] MCP configs loaded in 1ms
2026-01-13T04:38:05.113Z [DEBUG] LSP server manager initialized successfully
2026-01-13T04:38:05.113Z [DEBUG] LSP notification handlers registered successfully for all 0 server(s)
2026-01-13T04:38:05.119Z [DEBUG] [STARTUP] Running setup()...
2026-01-13T04:38:05.120Z [DEBUG] Stats cache does not exist, returning empty cache
2026-01-13T04:38:05.122Z [DEBUG] Stats cache empty, processing all historical data in background
2026-01-13T04:38:05.134Z [DEBUG] Loading skills from: managed=/etc/claude-code/.claude/skills, user=/home/home/.claude/skills, project=[]
2026-01-13T04:38:05.445Z [DEBUG] installed_plugins.json doesn't exist, returning empty V2 object
2026-01-13T04:38:05.448Z [DEBUG] Error log sink initialized
2026-01-13T04:38:05.450Z [DEBUG] Writing to temp file: /home/home/.claude/todos/f0f841bd-e89e-4665-9114-8d8fa55a8f30-agent-f0f841bd-e89e-4665-9114-8d8fa55a8f30.json.tmp.1880861.1768279085450
2026-01-13T04:38:05.455Z [DEBUG] Temp file written successfully, size: 2 bytes
2026-01-13T04:38:05.455Z [DEBUG] Renaming /home/home/.claude/todos/f0f841bd-e89e-4665-9114-8d8fa55a8f30-agent-f0f841bd-e89e-4665-9114-8d8fa55a8f30.json.tmp.1880861.1768279085450 to /home/home/.claude/todos/f0f841bd-e89e-4665-9114-8d8fa55a8f30-agent-f0f841bd-e89e-4665-9114-8d8fa55a8f30.json
2026-01-13T04:38:05.455Z [DEBUG] File /home/home/.claude/todos/f0f841bd-e89e-4665-9114-8d8fa55a8f30-agent-f0f841bd-e89e-4665-9114-8d8fa55a8f30.json written atomically
2026-01-13T04:38:05.475Z [DEBUG] getPluginSkills: Processing 0 enabled plugins
2026-01-13T04:38:05.475Z [DEBUG] Total plugin skills loaded: 0
2026-01-13T04:38:05.475Z [DEBUG] Total plugin commands loaded: 0
2026-01-13T04:38:05.475Z [DEBUG] Registered 0 hooks from 0 plugins
2026-01-13T04:38:05.516Z [DEBUG] [STARTUP] setup() completed in 397ms
2026-01-13T04:38:05.516Z [DEBUG] [STARTUP] Loading commands and agents...
2026-01-13T04:38:05.539Z [DEBUG] Total plugin agents loaded: 0
2026-01-13T04:38:05.539Z [DEBUG] Loaded 0 unique skills (managed: 0, user: 0, project: 0, legacy commands: 0)
2026-01-13T04:38:05.539Z [DEBUG] getSkills returning: 0 skill dir commands, 0 plugin skills, 0 bundled skills
2026-01-13T04:38:05.540Z [DEBUG] [STARTUP] Commands and agents loaded in 24ms
2026-01-13T04:38:05.540Z [DEBUG] [STARTUP] Running showSetupScreens()...
2026-01-13T04:38:05.542Z [DEBUG] [STARTUP] showSetupScreens() completed in 2ms
2026-01-13T04:38:05.543Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:05.543Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:05.545Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:05.546Z [DEBUG] Initialized versioned plugins system with 0 plugins
2026-01-13T04:38:05.550Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279085550
2026-01-13T04:38:05.550Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:38:05.555Z [DEBUG] Temp file written successfully, size: 230868 bytes
2026-01-13T04:38:05.555Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:38:05.555Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279085550 to /home/home/.claude.json
2026-01-13T04:38:05.555Z [DEBUG] File /home/home/.claude.json written atomically
2026-01-13T04:38:05.559Z [DEBUG] Getting matching hook commands for SessionStart with query: startup
2026-01-13T04:38:05.559Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:05.559Z [DEBUG] Matched 0 unique hooks for query "startup" (0 before deduplication)
2026-01-13T04:38:05.560Z [DEBUG] [render] initYoga starting
2026-01-13T04:38:05.573Z [DEBUG] Cannot acquire lock for 2.1.6 - held by PID 1812277
2026-01-13T04:38:05.573Z [ERROR] Error: Error: NON-FATAL: Lock acquisition failed for /home/home/.local/share/claude/versions/2.1.6 (expected in multi-process scenarios)
at ZZ$ (/$bunfs/root/claude:2761:2157)
at FPA (/$bunfs/root/claude:2761:1268)
at processTicksAndRejections (native:7:39)
2026-01-13T04:38:05.574Z [DEBUG] Summarizing all 3 messages (~0 tokens)
2026-01-13T04:38:05.575Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:05.576Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:05.576Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:05.576Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:05.580Z [DEBUG] [render] initYoga complete
2026-01-13T04:38:05.677Z [DEBUG] [keybindings] KeybindingSetup initialized with 40 bindings, 0 warnings
2026-01-13T04:38:05.724Z [DEBUG] [keybindings] Skipping file watcher - user customization disabled
2026-01-13T04:38:05.724Z [DEBUG] [REPL:mount] REPL mounted, disabled=false
2026-01-13T04:38:06.048Z [DEBUG] Official marketplace auto-install skipped: already_attempted
2026-01-13T04:38:06.048Z [DEBUG] performStartupChecks called
2026-01-13T04:38:06.049Z [DEBUG] Starting background plugin installations
2026-01-13T04:38:06.049Z [DEBUG] performBackgroundPluginInstallations called
2026-01-13T04:38:06.371Z [DEBUG] AutoUpdaterWrapper: Installation type: native
2026-01-13T04:38:06.685Z [DEBUG] Setting installation status: 0 marketplaces, 0 installable plugins, 0 uninstallable plugins
2026-01-13T04:38:06.685Z [DEBUG] Loaded plugins - Enabled: 0, Disabled: 0, Commands: 0, Agents: 0, Errors: 0
2026-01-13T04:38:06.690Z [DEBUG] Skills and commands included in Skill tool:
2026-01-13T04:38:06.691Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:06.691Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:06.691Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:06.692Z [DEBUG] Creating shell snapshot for bash (/bin/bash)
2026-01-13T04:38:06.692Z [DEBUG] Looking for shell config file: /home/home/.bashrc
2026-01-13T04:38:06.692Z [DEBUG] Snapshots directory: /home/home/.claude/shell-snapshots
2026-01-13T04:38:06.693Z [DEBUG] Creating snapshot at: /home/home/.claude/shell-snapshots/snapshot-bash-1768279086692-lnl6ru.sh
2026-01-13T04:38:06.693Z [DEBUG] Shell binary exists: true
2026-01-13T04:38:06.693Z [DEBUG] Execution timeout: 10000ms
2026-01-13T04:38:06.694Z [DEBUG] Git remote URL: null
2026-01-13T04:38:06.694Z [DEBUG] No git remote URL found
2026-01-13T04:38:06.694Z [DEBUG] Not in a GitHub repository, skipping path mapping update
2026-01-13T04:38:06.709Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:06.717Z [DEBUG] Summarizing all 9 messages (~11391 tokens)
2026-01-13T04:38:06.717Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:06.718Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:06.718Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:06.718Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:06.721Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279086721
2026-01-13T04:38:06.721Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:38:06.723Z [DEBUG] Temp file written successfully, size: 230868 bytes
2026-01-13T04:38:06.723Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:38:06.723Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279086721 to /home/home/.claude.json
2026-01-13T04:38:06.723Z [DEBUG] File /home/home/.claude.json written atomically
2026-01-13T04:38:06.734Z [DEBUG] Shell snapshot created successfully (4917 bytes)
2026-01-13T04:38:06.757Z [DEBUG] Protecting locked version from cleanup: 2.1.5
2026-01-13T04:38:06.766Z [DEBUG] Protecting locked version from cleanup: 2.1.4
2026-01-13T04:38:07.009Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyFkCfTgUfqHrDvgm7"}
2026-01-13T04:38:07.010Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:07.010Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:07.010Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:07.072Z [DEBUG] Checking for native installer update to version 2.1.6
2026-01-13T04:38:07.073Z [DEBUG] Found 2.1.6 at /home/home/.local/bin/claude, skipping install
2026-01-13T04:38:07.380Z [ERROR] Error in non-streaming fallback: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyHGjMoc4t2wgGSbBj"}
2026-01-13T04:38:07.380Z [ERROR] Error: Error: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyHGjMoc4t2wgGSbBj"}
at generate (/$bunfs/root/claude:437:33700)
at makeRequest (/$bunfs/root/claude:869:5435)
at processTicksAndRejections (native:7:39)
2026-01-13T04:38:07.382Z [DEBUG] Summarizing all 18 messages (~20045 tokens)
2026-01-13T04:38:07.382Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:07.383Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:07.383Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:07.383Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:07.957Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyJoWci6kPfh6w7XR5"}
2026-01-13T04:38:07.957Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:07.957Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:07.957Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:08.250Z [ERROR] Error in non-streaming fallback: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyMNYV8HGKS4XAgwkP"}
2026-01-13T04:38:08.251Z [ERROR] Error: Error: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyMNYV8HGKS4XAgwkP"}
at generate (/$bunfs/root/claude:437:33700)
at makeRequest (/$bunfs/root/claude:869:5435)
at processTicksAndRejections (native:7:39)
2026-01-13T04:38:09.921Z [DEBUG] Stored paste 3ed13ed9bedef780 to /home/home/.claude/paste-cache/3ed13ed9bedef780.txt
2026-01-13T04:38:09.957Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:38:09.957Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:38:09.957Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:38:09.957Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:38:09.986Z [DEBUG] Getting matching hook commands for UserPromptSubmit with query: undefined
2026-01-13T04:38:09.986Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:09.986Z [DEBUG] Matched 0 unique hooks for query "no match query" (0 before deduplication)
2026-01-13T04:38:09.991Z [DEBUG] FileHistory: Added snapshot for d31bd721-6f61-4a73-a5db-8cb6cb65333f, tracking 0 files
2026-01-13T04:38:10.009Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:10.011Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:10.011Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:10.011Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:10.012Z [DEBUG] Total plugin output styles loaded: 0
2026-01-13T04:38:10.015Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:38:10.027Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:10.027Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:10.027Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:10.502Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kyWiN71UPdzpoDEbJU"}
2026-01-13T04:38:10.502Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:10.502Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:10.502Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:12.400Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:20.285Z [DEBUG] executePreToolHooks called for tool: Bash
2026-01-13T04:38:20.286Z [DEBUG] executePreToolHooks called for tool: Bash
2026-01-13T04:38:20.296Z [DEBUG] Getting matching hook commands for PreToolUse with query: Bash
2026-01-13T04:38:20.296Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.296Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:38:20.296Z [DEBUG] Getting matching hook commands for PreToolUse with query: Bash
2026-01-13T04:38:20.296Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.296Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:38:20.296Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:38:20.302Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:38:20.302Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.302Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:20.346Z [DEBUG] tree-sitter: loaded from embedded
2026-01-13T04:38:20.364Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:38:20.364Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.364Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:20.366Z [DEBUG] No session environment scripts found
2026-01-13T04:38:20.389Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:20.390Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:20.390Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:20.390Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:20.405Z [DEBUG] Getting matching hook commands for PostToolUse with query: Bash
2026-01-13T04:38:20.405Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.405Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:38:20.856Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:20.857Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:20.857Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:20.857Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:20.870Z [DEBUG] Getting matching hook commands for PostToolUse with query: Bash
2026-01-13T04:38:20.870Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:20.870Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:38:20.884Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:38:20.885Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:38:20.885Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:38:20.885Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:38:20.903Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:38:20.905Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:20.905Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:20.905Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:21.227Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:21.344Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:22.116Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4kzMj9sei9QrjBTLNUh"}
2026-01-13T04:38:22.116Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:22.116Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:22.117Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:31.089Z [DEBUG] executePreToolHooks called for tool: Glob
2026-01-13T04:38:31.090Z [DEBUG] executePreToolHooks called for tool: Grep
2026-01-13T04:38:31.091Z [DEBUG] Getting matching hook commands for PreToolUse with query: Glob
2026-01-13T04:38:31.091Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.091Z [DEBUG] Matched 0 unique hooks for query "Glob" (0 before deduplication)
2026-01-13T04:38:31.100Z [DEBUG] Getting matching hook commands for PreToolUse with query: Grep
2026-01-13T04:38:31.100Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.100Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:31.100Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:38:31.103Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:38:31.103Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.103Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:31.120Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:31.120Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:31.121Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:31.606Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:38:31.606Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.606Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:31.611Z [DEBUG] Ripgrep first use test: PASSED (mode=builtin, path=/home/home/.local/share/claude/versions/2.1.6)
2026-01-13T04:38:31.623Z [DEBUG] Getting matching hook commands for PostToolUse with query: Glob
2026-01-13T04:38:31.623Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.623Z [DEBUG] Matched 0 unique hooks for query "Glob" (0 before deduplication)
2026-01-13T04:38:31.629Z [DEBUG] Getting matching hook commands for PostToolUse with query: Grep
2026-01-13T04:38:31.629Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:31.629Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:31.642Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:38:31.642Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:38:31.642Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:38:31.642Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:38:31.654Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:38:31.657Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:31.657Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:31.657Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:33.416Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:38.031Z [DEBUG] executePreToolHooks called for tool: Grep
2026-01-13T04:38:38.035Z [DEBUG] Getting matching hook commands for PreToolUse with query: Grep
2026-01-13T04:38:38.035Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:38.035Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:38.035Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:38:38.037Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:38:38.037Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:38.037Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:38.055Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:38:38.055Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:38.055Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:38.422Z [DEBUG] Getting matching hook commands for PostToolUse with query: Grep
2026-01-13T04:38:38.422Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:38.422Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:38.430Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:38:38.430Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:38:38.430Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:38:38.430Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:38:38.441Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:38:38.444Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:38.444Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:38.444Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:39.031Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4m1ba852sqBs1unhK7x"}
2026-01-13T04:38:39.031Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:39.031Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:39.031Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:44.728Z [DEBUG] executePreToolHooks called for tool: Grep
2026-01-13T04:38:44.728Z [DEBUG] Getting matching hook commands for PreToolUse with query: Grep
2026-01-13T04:38:44.728Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:44.728Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:44.735Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:38:44.737Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:38:44.737Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:44.737Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:44.754Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:38:44.754Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:44.754Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:45.122Z [DEBUG] Getting matching hook commands for PostToolUse with query: Grep
2026-01-13T04:38:45.122Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:45.122Z [DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
2026-01-13T04:38:45.129Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:38:45.129Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:38:45.129Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:38:45.129Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:38:45.140Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:38:45.144Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:45.144Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:45.144Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:47.221Z [DEBUG] Stream started - received first chunk
2026-01-13T04:38:59.498Z [DEBUG] executePreToolHooks called for tool: Glob
2026-01-13T04:38:59.511Z [DEBUG] Getting matching hook commands for PreToolUse with query: Glob
2026-01-13T04:38:59.511Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:59.511Z [DEBUG] Matched 0 unique hooks for query "Glob" (0 before deduplication)
2026-01-13T04:38:59.511Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:38:59.514Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:38:59.514Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:59.514Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:59.532Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:38:59.532Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:59.532Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:38:59.966Z [DEBUG] Getting matching hook commands for PostToolUse with query: Glob
2026-01-13T04:38:59.966Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:59.966Z [DEBUG] Matched 0 unique hooks for query "Glob" (0 before deduplication)
2026-01-13T04:38:59.971Z [DEBUG] executePreToolHooks called for tool: Bash
2026-01-13T04:38:59.975Z [DEBUG] Getting matching hook commands for PreToolUse with query: Bash
2026-01-13T04:38:59.975Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:38:59.975Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:38:59.993Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:59.993Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:38:59.993Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:59.993Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:59.993Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:38:59.993Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:38:59.994Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:38:59.994Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:00.451Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4m37icytysn8QkLA7Mr"}
2026-01-13T04:39:00.451Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:39:00.451Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:39:00.451Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:01.121Z [DEBUG] Stream started - received first chunk
2026-01-13T04:39:01.695Z [DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
2026-01-13T04:39:01.696Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:39:01.696Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:39:01.696Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:01.710Z [DEBUG] Getting matching hook commands for PostToolUse with query: Bash
2026-01-13T04:39:01.710Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:01.710Z [DEBUG] Matched 0 unique hooks for query "Bash" (0 before deduplication)
2026-01-13T04:39:01.717Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:39:01.717Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:39:01.717Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:39:01.717Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:39:01.732Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:39:01.734Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:39:01.734Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:39:01.734Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:02.123Z [DEBUG] Stream started - received first chunk
2026-01-13T04:39:03.546Z [DEBUG] Stream started - received first chunk
2026-01-13T04:39:05.576Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:39:05.577Z [DEBUG] executePreToolHooks called for tool: Read
2026-01-13T04:39:05.584Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:39:05.584Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:05.584Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:39:05.584Z [DEBUG] Getting matching hook commands for PreToolUse with query: Read
2026-01-13T04:39:05.584Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:05.584Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:39:05.600Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:39:05.600Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:05.600Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:39:05.600Z [DEBUG] Getting matching hook commands for PostToolUse with query: Read
2026-01-13T04:39:05.600Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:05.600Z [DEBUG] Matched 0 unique hooks for query "Read" (0 before deduplication)
2026-01-13T04:39:05.607Z [DEBUG] LSP Diagnostics: getLSPDiagnosticAttachments called
2026-01-13T04:39:05.607Z [DEBUG] LSP Diagnostics: Checking registry - 0 pending
2026-01-13T04:39:05.607Z [DEBUG] Hooks: Found 0 total hooks in registry
2026-01-13T04:39:05.607Z [DEBUG] Hooks: checkForNewResponses returning 0 responses
2026-01-13T04:39:05.619Z [DEBUG] Auto tool search disabled: 0 chars (threshold: 50000, 10% of context)
2026-01-13T04:39:05.623Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:39:05.623Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:39:05.623Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:06.160Z [ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4m3YpEY4DAVuyDWK5WX"}
2026-01-13T04:39:06.160Z [DEBUG] [API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
2026-01-13T04:39:06.160Z [DEBUG] [API:auth] OAuth token check starting
2026-01-13T04:39:06.160Z [DEBUG] [API:auth] OAuth token check complete
2026-01-13T04:39:06.800Z [ERROR] Error in non-streaming fallback: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4m3bFpgVMdZTwNVMPZV"}
2026-01-13T04:39:06.800Z [ERROR] Error: Error: 403 {"type":"error","error":{"type":"permission_error","message":"Permission denied"},"request_id":"req_011CX4m3bFpgVMdZTwNVMPZV"}
at generate (/$bunfs/root/claude:437:33700)
at makeRequest (/$bunfs/root/claude:869:5435)
at processTicksAndRejections (native:7:39)
2026-01-13T04:39:06.809Z [DEBUG] Getting matching hook commands for Stop with query: undefined
2026-01-13T04:39:06.809Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:39:06.809Z [DEBUG] Matched 0 unique hooks for query "no match query" (0 before deduplication)
2026-01-13T04:39:07.440Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279147440
2026-01-13T04:39:07.440Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:39:07.450Z [DEBUG] Temp file written successfully, size: 230868 bytes
2026-01-13T04:39:07.450Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:39:07.450Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279147440 to /home/home/.claude.json
2026-01-13T04:39:07.450Z [DEBUG] File /home/home/.claude.json written atomically
2026-01-13T04:39:07.458Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279147458
2026-01-13T04:39:07.458Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:39:07.460Z [DEBUG] Temp file written successfully, size: 230868 bytes
2026-01-13T04:39:07.460Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:39:07.460Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279147458 to /home/home/.claude.json
2026-01-13T04:39:07.460Z [DEBUG] File /home/home/.claude.json written atomically
2026-01-13T04:40:07.791Z [DEBUG] Getting matching hook commands for Notification with query: idle_prompt
2026-01-13T04:40:07.791Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:40:07.791Z [DEBUG] Matched 0 unique hooks for query "idle_prompt" (0 before deduplication)
2026-01-13T04:40:57.918Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279257918
2026-01-13T04:40:57.918Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:40:57.921Z [DEBUG] Temp file written successfully, size: 230868 bytes
2026-01-13T04:40:57.921Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:40:57.921Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279257918 to /home/home/.claude.json
2026-01-13T04:40:57.921Z [DEBUG] File /home/home/.claude.json written atomically
2026-01-13T04:40:58.849Z [DEBUG] Getting matching hook commands for SessionEnd with query: prompt_input_exit
2026-01-13T04:40:58.849Z [DEBUG] Found 0 hook matchers in settings
2026-01-13T04:40:58.849Z [DEBUG] Matched 0 unique hooks for query "prompt_input_exit" (0 before deduplication)
2026-01-13T04:40:58.852Z [DEBUG] Cleaned up session snapshot: /home/home/.claude/shell-snapshots/snapshot-bash-1768279086692-lnl6ru.sh
2026-01-13T04:40:58.853Z [DEBUG] LSP server manager shut down successfully
2026-01-13T04:40:59.413Z [DEBUG] Writing to temp file: /home/home/.claude.json.tmp.1880861.1768279259413
2026-01-13T04:40:59.413Z [DEBUG] Preserving file permissions: 100600
2026-01-13T04:40:59.436Z [DEBUG] Temp file written successfully, size: 230876 bytes
2026-01-13T04:40:59.436Z [DEBUG] Applied original permissions to temp file
2026-01-13T04:40:59.436Z [DEBUG] Renaming /home/home/.claude.json.tmp.1880861.1768279259413 to /home/home/.claude.json
2026-01-13T04:40:59.436Z [DEBUG] File /home/home/.claude.json written atomically
Steps to Reproduce
** Debug mode enabled
Logging to: /home/home/.claude/debug/f0f841bd-e89e-4665-9114-8d8fa55a8f30.txt
❯ ❯ We’re seeing a mismatch between the Claude CLI control protocol and the Python/Elixir SDKs’ can_use_tool permission
callbacks. We need to determine whether the CLI is supposed to emit control_request events (subtype: "can_use_tool")
when
--permission-prompt-tool stdio is active, and why it isn’t in CLI 2.1.6.
Context / expectation
- Both SDKs implement can_use_tool by enabling the control protocol and setting --permission-prompt-tool stdio.
- The control protocol defines control_request with subtype: "can_use_tool" and expects the SDK to respond
allow/deny.
- If the CLI does not emit those control callbacks, permission hooks can never fire (even though tool use itself
works).
What I did
I added a Python‑side repro script that uses the local SDK source (no install needed) and registers a can_use_tool
callback. It forces a Write tool call and fails if no permission callbacks are observed.
Script path:
/home/home/p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py
Current status / repro output (CLI 2.1.6)
$ python3 /home/home/p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py
====================================================================
Permission Callback Probe (Python SDK, live CLI)
====================================================================
Claude CLI: claude
Claude CLI version: 2.1.6 (Claude Code)
Prompt:
Use the Write tool to create a file with the exact path and content below.
file_path: /home/home/p/g/n/claude-agent-sdk-python/examples/_output/permissions_callback_probe.txt
content: hello from permissions probe
After the write completes, reply with exactly: WROTE
WROTE
FAILED:
- No can_use_tool callbacks observed from CLI control protocol.
Claude CLI version: 2.1.6 (Claude Code)
Why this matters
- Tool use is happening and the CLI completes the action, but no can_use_tool control callbacks are ever emitted, so
SDK
permission hooks never run.
- This blocks the SDK from enforcing/observing tool permissions even though the protocol says it should.
Questions
1. Is CLI 2.1.6 expected to emit control_request / can_use_tool callbacks when --permission-prompt-tool stdio is
set?
2. If yes, is this a known CLI regression?
3. If no, is the SDK’s permission callback feature ahead of the CLI and should be documented as not supported?
4. Is there a CLI flag or config required to enable these callbacks beyond --permission-prompt-tool stdio?
We need to confirm whether this is a CLI bug, a protocol mismatch, or a missing CLI flag.
● I'll help investigate this control protocol mismatch. Let me start by examining the repro script and then exploring what we can find about the CLI's control protocol implementation.
● Read(p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py)
⎿ Read 174 lines
● Bash(which claude)
⎿ /home/home/.local/bin/claude
● Bash(claude --help 2>&1 | grep -i "permission\|control\|protocol" -A 2 -B 2)
⎿ --agent <agent> Agent for the current session. Overrides the 'agent' setting.
--agents <json> JSON object defining custom agents (e.g. '{"reviewer":
{"description":
"Reviews code", "prompt": "You are a code reviewer"}}')
… +23 lines (ctrl+o to expand)
⎿ Loaded p/g/n/claude-agent-sdk-python/CLAUDE.md
● Now let me examine the SDK's CLI transport implementation to understand how it expects the control protocol to work.
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/transport/subprocess_cli.py)
⎿ Read 673 lines
● Search(pattern: "**/*control*protocol*.md", path: "p/g/n/claude-agent-sdk-python")
⎿ Found 0 files
● Search(pattern: "control.*protocol|can_use_tool|control_request", path: "p/g/n/claude-agent-sdk-python", glob: "*.md")
⎿ Found 1 file (ctrl+o to expand)
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/client.py)
⎿ Read 200 lines
● Search(pattern: "permission_prompt_tool|can_use_tool|control", path: "p/g/n/claude-agent-sdk-python/src/claude_agent_sdk",
output_mode: "content", head_limit: 50)
⎿ Found 50 lines (ctrl+o to expand)
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/query.py)
⎿ Read 100 lines
● Search(pattern: "_handle_control_request", path: "p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/query.py",
output_mode: "content")
⎿ Found 83 lines (ctrl+o to expand)
● Now let me check the CHANGELOG and any docs about this feature to see if there's been recent changes.
● Read(p/g/n/claude-agent-sdk-python/CHANGELOG.md)
⎿ Read 100 lines
● Search(pattern: "**/*permission*", path: "p/g/n/claude-agent-sdk-python")
⎿ Found 4 files (ctrl+o to expand)
● Bash(claude --permission-prompt-tool 2>&1 | head -20)
⎿ error: option '--permission-prompt-tool <tool>' argument missing
● Read(p/g/n/claude-agent-sdk-python/examples/tool_permission_callback.py)
⎿ Read 159 lines
● Read(p/g/n/claude-agent-sdk-python/e2e-tests/test_tool_permissions.py)
⎿ Read 43 lines
⎿ API Error: 403 {"type":"error","error":{"type":"permission_error","message":"Permission
denied"},"request_id":"req_011CX4m3bFpgVMdZTwNVMPZV"} · Please run /login
✻ Brewed for 57s
**
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
2.1.6
Claude Code Version
2.1.6
Platform
Other
Operating System
macOS
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Consistently getting 403'ed after a few turns on this one machine.
** Debug mode enabled
Logging to: /home/home/.claude/debug/f0f841bd-e89e-4665-9114-8d8fa55a8f30.txt
❯ ❯ We’re seeing a mismatch between the Claude CLI control protocol and the Python/Elixir SDKs’ can_use_tool permission
callbacks. We need to determine whether the CLI is supposed to emit control_request events (subtype: "can_use_tool")
when
--permission-prompt-tool stdio is active, and why it isn’t in CLI 2.1.6.
Context / expectation
- Both SDKs implement can_use_tool by enabling the control protocol and setting --permission-prompt-tool stdio.
- The control protocol defines control_request with subtype: "can_use_tool" and expects the SDK to respond
allow/deny.
- If the CLI does not emit those control callbacks, permission hooks can never fire (even though tool use itself
works).
What I did
I added a Python‑side repro script that uses the local SDK source (no install needed) and registers a can_use_tool
callback. It forces a Write tool call and fails if no permission callbacks are observed.
Script path:
/home/home/p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py
Current status / repro output (CLI 2.1.6)
$ python3 /home/home/p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py
====================================================================
Permission Callback Probe (Python SDK, live CLI)
====================================================================
Claude CLI: claude
Claude CLI version: 2.1.6 (Claude Code)
Prompt:
Use the Write tool to create a file with the exact path and content below.
file_path: /home/home/p/g/n/claude-agent-sdk-python/examples/_output/permissions_callback_probe.txt
content: hello from permissions probe
After the write completes, reply with exactly: WROTE
WROTE
FAILED:
- No can_use_tool callbacks observed from CLI control protocol.
Claude CLI version: 2.1.6 (Claude Code)
Why this matters
- Tool use is happening and the CLI completes the action, but no can_use_tool control callbacks are ever emitted, so
SDK
permission hooks never run.
- This blocks the SDK from enforcing/observing tool permissions even though the protocol says it should.
Questions
1. Is CLI 2.1.6 expected to emit control_request / can_use_tool callbacks when --permission-prompt-tool stdio is
set?
2. If yes, is this a known CLI regression?
3. If no, is the SDK’s permission callback feature ahead of the CLI and should be documented as not supported?
4. Is there a CLI flag or config required to enable these callbacks beyond --permission-prompt-tool stdio?
We need to confirm whether this is a CLI bug, a protocol mismatch, or a missing CLI flag.
● I'll help investigate this control protocol mismatch. Let me start by examining the repro script and then exploring what we can find about the CLI's control protocol implementation.
● Read(p/g/n/claude-agent-sdk-python/examples/permission_callback_probe.py)
⎿ Read 174 lines
● Bash(which claude)
⎿ /home/home/.local/bin/claude
● Bash(claude --help 2>&1 | grep -i "permission\|control\|protocol" -A 2 -B 2)
⎿ --agent <agent> Agent for the current session. Overrides the 'agent' setting.
--agents <json> JSON object defining custom agents (e.g. '{"reviewer":
{"description":
"Reviews code", "prompt": "You are a code reviewer"}}')
… +23 lines (ctrl+o to expand)
⎿ Loaded p/g/n/claude-agent-sdk-python/CLAUDE.md
● Now let me examine the SDK's CLI transport implementation to understand how it expects the control protocol to work.
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/transport/subprocess_cli.py)
⎿ Read 673 lines
● Search(pattern: "**/*control*protocol*.md", path: "p/g/n/claude-agent-sdk-python")
⎿ Found 0 files
● Search(pattern: "control.*protocol|can_use_tool|control_request", path: "p/g/n/claude-agent-sdk-python", glob: "*.md")
⎿ Found 1 file (ctrl+o to expand)
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/client.py)
⎿ Read 200 lines
● Search(pattern: "permission_prompt_tool|can_use_tool|control", path: "p/g/n/claude-agent-sdk-python/src/claude_agent_sdk",
output_mode: "content", head_limit: 50)
⎿ Found 50 lines (ctrl+o to expand)
● Read(p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/query.py)
⎿ Read 100 lines
● Search(pattern: "_handle_control_request", path: "p/g/n/claude-agent-sdk-python/src/claude_agent_sdk/_internal/query.py",
output_mode: "content")
⎿ Found 83 lines (ctrl+o to expand)
● Now let me check the CHANGELOG and any docs about this feature to see if there's been recent changes.
● Read(p/g/n/claude-agent-sdk-python/CHANGELOG.md)
⎿ Read 100 lines
● Search(pattern: "**/*permission*", path: "p/g/n/claude-agent-sdk-python")
⎿ Found 4 files (ctrl+o to expand)
● Bash(claude --permission-prompt-tool 2>&1 | head -20)
⎿ error: option '--permission-prompt-tool <tool>' argument missing
● Read(p/g/n/claude-agent-sdk-python/examples/tool_permission_callback.py)
⎿ Read 159 lines
● Read(p/g/n/claude-agent-sdk-python/e2e-tests/test_tool_permissions.py)
⎿ Read 43 lines
⎿ API Error: 403 {"type":"error","error":{"type":"permission_error","message":"Permission
denied"},"request_id":"req_011CX4m3bFpgVMdZTwNVMPZV"} · Please run /login
✻ Brewed for 57s
**This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗