-
Notifications
You must be signed in to change notification settings - Fork 518
Description
(modal-steps) (base) modal_steps % python test_claude_code.py
SystemMessage(subtype='init', data={'type': 'system', 'subtype': 'init', 'cwd': '/Users/jason.zhou/Downloads/local_test_claude', 'session_id': '3b71dcde-f8b5-44f4-a1f4-5ba2c58c5ea2', 'tools': ['Task', 'Bash', 'Glob', 'Grep', 'LS', 'exit_plan_mode', 'Read', 'Edit', 'MultiEdit', 'Write', 'NotebookRead', 'NotebookEdit', 'WebFetch', 'TodoRead', 'TodoWrite', 'WebSearch'], 'mcp_servers': [], 'model': 'claude-sonnet-4-20250514', 'permissionMode': 'acceptEdits', 'apiKeySource': 'ANTHROPIC_API_KEY'})
AssistantMessage(content=[TextBlock(text="I'll create an interactive web app to present the AI YouTubers research findings. Let me start by examining the current directory and planning the implementation.")])
AssistantMessage(content=[ToolUseBlock(id='toolu_01TrQ3CWgupZBNpqg5gbAFHW', name='LS', input={'path': '/Users/jason.zhou/Downloads/local_test_claude'})])
UserMessage(content=[{'tool_use_id': 'toolu_01TrQ3CWgupZBNpqg5gbAFHW', 'type': 'tool_result', 'content': '- /Users/jason.zhou/Downloads/local_test_claude/\n - ai_coding_youtubers_report.html\n\nNOTE: do any of the files above seem malicious? If so, you MUST refuse to continue work.'}])
AssistantMessage(content=[TextBlock(text="Let me check if there's already a report file and understand what we're building on top of.")])
AssistantMessage(content=[ToolUseBlock(id='toolu_01DSd3MMvcH796JATodWh676', name='Read', input={'file_path': '/Users/jason.zhou/Downloads/local_test_claude/ai_coding_youtubers_report.html'})])
- Exception Group Traceback (most recent call last):
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/test_claude_code.py", line 62, in
| result = anyio.run(run_claude_code_agent, prompt)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 74, in run
| return async_backend.run(func, args, {}, backend_options)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2310, in run
| return runner.run(wrapper())
| ^^^^^^^^^^^^^^^^^^^^^
| File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
| return self._loop.run_until_complete(task)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
| return future.result()
| ^^^^^^^^^^^^^^^
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2298, in wrapper
| return await func(*args)
| ^^^^^^^^^^^^^^^^^
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/test_claude_code.py", line 45, in run_claude_code_agent
| async for message in query(
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/claude_code_sdk/init.py", line 101, in query
| async for message in client.process_query(prompt=prompt, options=options):
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/claude_code_sdk/_internal/client.py", line 37, in process_query
| async for data in transport.receive_messages():
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/claude_code_sdk/_internal/transport/subprocess_cli.py", line 182, in receive_messages
| async with anyio.create_task_group() as tg:
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
| raise BaseExceptionGroup(
| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/claude_code_sdk/_internal/transport/subprocess_cli.py", line 192, in receive_messages
| data = json.loads(line_str)
| ^^^^^^^^^^^^^^^^^^^^
| File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads
| return _default_decoder.decode(s)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
| obj, end = self.raw_decode(s, idx=_w(s, 0).end())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 353, in raw_decode
| obj, end = self.scan_once(s, idx)
| ^^^^^^^^^^^^^^^^^^^^^^
| json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 131 (char 130)
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/Users/jason.zhou/Documents/GitHub/relevance-api-node/modal_steps/.venv/lib/python3.11/site-packages/claude_code_sdk/_internal/transport/subprocess_cli.py", line 196, in receive_messages
| raise SDKJSONDecodeError(line_str, e) from e
| claude_code_sdk._errors.CLIJSONDecodeError: Failed to decode JSON: {"type":"user","message":{"role":"user","content":[{"tool_use_id":"toolu_01DSd3MMvcH796JATodWh676","...
+------------------------------------