npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@akz-tools/claude-fix

v1.0.2

Published

Fix: API Error 400 due to tool use concurrency issues — repairs broken Claude Code conversations

Readme

claude-fix

Community fix scripts for Claude Code bugs.

npx @akz-tools/claude-fix <fix-name> <session-id>

Available Fixes

orphaned-toolcalls — Fix "400 tool use concurrency" error

API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.

If you're seeing this error in Claude Code and /rewind doesn't help — this tool fixes it.

The most reported unfixed bug in Claude Code (15+ GitHub issues, countless Reddit posts). Makes conversations permanently unresumable. /rewind doesn't help. /compact can make it worse.

Usage

# Step 1: Find your broken session ID
npx @akz-tools/claude-fix orphaned-toolcalls --list

# Step 2: Fix it
npx @akz-tools/claude-fix orphaned-toolcalls <session-id>

# Step 3: Resume
claude --resume <new-session-id>

You can also dry-run to see what's wrong without fixing:

npx @akz-tools/claude-fix orphaned-toolcalls --dry-run <session-id>

How to find your session ID

  • In Claude Code, run: /conversations
  • Or: ls -lt ~/.claude/projects/*/*.jsonl | head -20
  • Or: npx @akz-tools/claude-fix orphaned-toolcalls --list

What it does

Creates a fixed clone of your broken conversation. The original is never touched.

Root cause

Claude Code stores conversations as a tree (each message links to its parent via parentUuid). When it runs tools concurrently (e.g., two Read calls in parallel), it creates branches:

assistant: "Let me read both files"
├── tool_use: Read(file_A)     ← branch 1
│   └── tool_result: <contents of A>
└── tool_use: Read(file_B)     ← branch 2
    └── tool_result: <contents of B>
        └── ... conversation continues on this branch

When Claude Code flattens this tree for the Anthropic API, it follows one branch — losing the tool_result on the sibling branch. The API sees a tool_use without a matching tool_result and returns 400.

User interruptions (pressing Escape) can also create consecutive same-role messages, which violate the API's alternating message requirement.

The fix:

  1. Walks the parentUuid chain to find the linearized path
  2. Detects missing tool_result blocks and consecutive same-role messages
  3. Grafts missing results from sibling branches (they exist in the JSONL, just on the wrong branch)
  4. Inserts synthetic error results for truly lost tool calls
  5. Merges consecutive user messages from interruptions
  6. Rebuilds with a clean linear parentUuid chain

Requirements

  • Node.js 18+
  • macOS or Linux

Contributing

Found another Claude Code bug that needs a fix script? PRs welcome. Each fix goes in its own directory:

claude-fixes/
├── cli.mjs                    # Router — npx @akz-tools/claude-fix <name>
├── fix-conversation/          # Fix: orphaned-toolcalls
│   └── index.mjs
├── fix-next-bug/              # Fix: next bug someone finds
│   └── index.mjs
└── ...

License

MIT