Skip to content

[BUG] --print mode generates duplicate tool_use IDs causing API error 400 #16340

Closed

Description

@kaidotio

Environment

  • Claude CLI version: 2.0.76
  • Operating System: Linux (Arch Linux 6.18.3)
  • Terminal: tmux

Bug Description

When using claude --print mode with prompts that require tool usage (e.g., file reading), the CLI generates duplicate tool_use IDs, causing an API error 400.

Error Message

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.1: `tool_use` ids must be unique"},"request_id":"..."}

Steps to Reproduce

  1. Run Claude CLI in print mode with a prompt requiring tool use:
claude --print --no-session-persistence "Read /path/to/file and summarize it"
  1. The command fails with the above error

Expected Behavior

Claude should successfully read the file and return a summary.

Actual Behavior

API returns error 400 indicating tool_use IDs are not unique.

Additional Context

  • Simple prompts that don't require tools work fine:
claude --print --no-session-persistence "What is 1+1?"  # Works
  • The issue occurs regardless of --no-session-persistence flag
  • Workaround: Using --tools "" to disable tools prevents the error, but also prevents Claude from using any tools

This appears to be a different issue from the tool_use/tool_result pairing issues in #6836 - this is specifically about duplicate ID generation.

🤖 Generated with Claude Code

Activity

  1. github-actions commented on Jan 12, 2026

    @github-actions

    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.

  2. locked as resolved and limited conversation to collaborators on Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions