Fix: omit --setting-sources flag when setting_sources is empty or unset#778
Merged
Fix: omit --setting-sources flag when setting_sources is empty or unset#778
Conversation
b32e173 to
7bdaba0
Compare
🏠 Remote-Dev: homespace
384c747 to
d5ad8ca
Compare
hackyon-anthropic
approved these changes
Mar 30, 2026
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.
Summary
When
setting_sourceswas not provided (None) or was an empty list, the SDK always passed--setting-sources ""to the CLI. The empty string argument causes the CLI argument parser to consume the next flag (e.g.--permission-mode) as the--setting-sourcesvalue, producing:This blocked all default SDK usage without an explicit
setting_sourcesworkaround.Fix
Only add
--setting-sourceswhensetting_sourcesis a non-empty list, matching the pattern used by other array-typed flags (allowed_tools,disallowed_tools,betas).Before:
After:
Testing
test_build_command_setting_sources_omitted_when_not_provided— nosetting_sources→ no--setting-sourcesflagtest_build_command_setting_sources_omitted_when_empty— empty[]→ no--setting-sourcesflagtest_build_command_setting_sources_included_when_provided—["user", "project"]→--setting-sources user,projectFixes anthropics/claude-agent-sdk-typescript#252