Jupyter Notebook File Reading Fails with 400 Bad Request Error
Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 3 comments · opened Mar 28, 2025 · closed May 25, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
running into 400s when asking claude to read from Notebook (jupyter) files
Environment Info
- Platform: macos
- Terminal: ghostty
- Version: 0.2.56
- Feedback ID: 5997f447-e059-4f8c-8cff-7229aa5b1ed1
Errors
[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.20.content.0.tool_result.content.1.image.source.base64: invalid base64 data\"}}\n at H6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1054:10176)\n at $6.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:7207)\n at $6.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:8149)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-28T00:38:51.997Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.20.content.0.tool_result.content.1.image.source.base64: invalid base64 data\"}}\n at H6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1054:10176)\n at $6.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:7207)\n at $6.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:8149)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-28T00:39:23.781Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.20.content.0.tool_result.content.1.image.source.base64: invalid base64 data\"}}\n at H6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1054:10176)\n at $6.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:7207)\n at $6.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:8149)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-28T00:39:43.534Z"}]
3 Comments
Related issues:
To reproduce the issue, please see the attached files, which are also summarized below.
](https://gist.github.com/stharrold/612feda6182e6d2e2c61a2d5f34ad6ab) Example Jupyter (IPython) notebook that reproduces the API Error 400 from a generated plot/graph/image that has invalid base64 data.
Terminal output from instructing Claude Code to read the Jupyter notebook, the subsequent API Error 400, and inability to exit error.
HTML export of Jupyter notebook for testing.
The impact of this issue is that the scientific, research, and data science communities extensively use Jupyter (IPython) notebooks with embedded images for interactive development and as self-documenting project workflows.
Enabling Claude Code to seamlessly read and write these Jupyter notebooks would dramatically enhance productivity across these domains.
Thank you so much your work on this impactful tool!
Excerpt from 20250504T093000Z_Claude-Code_Issue-Reproduce-400-Error-From-Ipynb-Base64-Image.ipynb
Excerpt from 20250504T093000Z_Claude-Code_Terminal-Output.txt
The fix will go out in v1.0.4.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.