Unable to pass "--timeout" in extra_args within ClaudeCodeOptions
I am trying to pass timeout as seen in the documentation:
async with ClaudeSDKClient(
options=ClaudeCodeOptions(
extra_args={
"verbose": None,
"timeout": "300"
}
)
) as client:
But I am receiving this error:
claude_code_sdk._errors.ProcessError: Command failed with exit code 1 (exit code: 1)
Error output: error: unknown option '--timeout'
Just use "timeout" instead. Here is how extra args are passed. They added a "--" already: https://github.com/anthropics/claude-code-sdk-python/blob/f794e17e785ebd1729259e7db365912da4c97686/src/claude_code_sdk/_internal/transport/subprocess_cli.py#L146
Just use "timeout" instead. Here is how extra args are passed. They added a "--" already:
claude-code-sdk-python/src/claude_code_sdk/_internal/transport/subprocess_cli.py
Line 146 in f794e17
for flag, value in self._options.extra_args.items():
Even without adding the "--" it still fails
I don't think --timeout is an actual flag (claude --help lists the flags). You'll need to implement the timeout on your end.
@ThariqS can you double check if the documentation example's use of "timeout" is actually valid? https://docs.anthropic.com/en/docs/claude-code/sdk/sdk-python#advanced-configuration-example