fix(sdk): pass [] instead of None for allowed/disallowed tools (NoneType crash)#206
Open
Aispotlightlab wants to merge 1 commit into
Open
fix(sdk): pass [] instead of None for allowed/disallowed tools (NoneType crash)#206Aispotlightlab wants to merge 1 commit into
Aispotlightlab wants to merge 1 commit into
Conversation
When DISABLE_TOOL_VALIDATION=true, ClaudeSDKManager was passing None for allowed_tools and disallowed_tools. The downstream claude-agent-sdk (versions 0.1.x through at least 0.2.82) calls `list(self._options.allowed_tools)` unconditionally in `subprocess_cli.py:_apply_skills_defaults` and crashes with "TypeError: 'NoneType' object is not iterable" before the CLI process even starts. Symptom: every Telegram message produces "Claude integration failed". This patches the symptom in Cct by passing empty lists. The CLI treats an empty list the same as "no --allowedTools flag" → no restriction, which is the intent of DISABLE_TOOL_VALIDATION=true. Filed upstream as well: https://github.com/anthropics/claude-agent-sdk-python (pending). Repro: set DISABLE_TOOL_VALIDATION=true + ENABLE_MCP=true in .env, send any message. SDK never returns past ClaudeSDKClient.connect(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
DISABLE_TOOL_VALIDATION=trueis set, every Telegram message producesClaude integration failedand the SDK crashes before the CLI even starts:Root cause
ClaudeSDKManager.run_command(src/claude/sdk_integration.py:314) passesNoneforsdk_allowed_tools/sdk_disallowed_toolswhendisable_tool_validationis true.Downstream,
claude-agent-sdk(verified on both 0.1.81 and the latest 0.2.82) callslist(self._options.allowed_tools)unconditionally insidesubprocess_cli.py::_apply_skills_defaults.list(None)→TypeError.This is a real bug in the SDK (no None-guard on a documented-as-optional field), but the fix here is trivial on the Cct side and unblocks every user who enables MCP with
DISABLE_TOOL_VALIDATION=true(the standard recipe for adding third-party MCP servers like MemPalace, Mem0, etc.).Fix
Pass
[]instead ofNone. The CLI treats an empty list as "no--allowedToolsflag" → no restriction, which matches the intent ofDISABLE_TOOL_VALIDATION=true.Reproduction
.env:DISABLE_TOOL_VALIDATION=true+ENABLE_MCP=true+ validMCP_CONFIG_PATHClaude integration failedon every turnVerified end-to-end with a 27-tool MemPalace MCP server (Python
mempalace-mcpbinary) onclaude-agent-sdk 0.1.81+ Cct 1.6.0.Upstream
Will file matching issue/PR upstream at anthropics/claude-agent-sdk-python so the SDK adds
or []on thelist()call. Until that lands, this Cct-side guard is the practical fix.🤖 Generated with Claude Code