claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Tool Execution Issues: Parallel execution, Grep regex error handling, and Read negative offset validation with Claude Cowork

Open gn00295120 opened this issue 10 months ago • 0 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [ ] This is a single bug report (Note: 3 related tool bugs consolidated for context)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Three tool execution issues discovered during Cowork mode testing:

Bug 1: Parallel Tool Calls Execute Sequentially

When multiple tool calls are made simultaneously in a single message, they execute sequentially rather than in parallel.

Bug 2: Grep Tool Returns Misleading Message for Invalid Regex

The Grep tool returns "No files found" instead of indicating a regex syntax error when given an invalid pattern.

Bug 3: Read Tool Accepts Negative Offset

The Read tool accepts negative offset values and produces output with negative line numbers (e.g., -5→, -4→).


What Should Happen?

Bug 1: Parallel Execution

  • Multiple independent tool calls should execute concurrently
  • 3 × 2-second sleep commands should complete in ~2s, not ~10s

Bug 2: Grep Error Handling

  • Invalid regex patterns should return clear error messages
  • Example: "Error: Invalid regular expression - Unmatched '(' at position 16"

Bug 3: Read Validation

  • Negative offset values should be rejected with a validation error
  • Example: "Error: offset must be a non-negative integer"

Steps to Reproduce

Bug 1: Parallel Execution

  1. Open Claude for Mac → Cowork mode
  2. Request: "Run three independent sleep 2 commands in parallel"
  3. Observe timestamps show sequential execution (~10s total, not ~2s)

Evidence:

Task 1 開始: 13:34:47.831843934
Task 1 結束: 13:34:49.833217566

Task 2 開始: 13:34:51.706488544  ← Started ~2s AFTER Task 1 ended
Task 2 結束: 13:34:53.707604785

Task 3 開始: 13:34:55.399567678  ← Started ~2s AFTER Task 2 ended
Task 3 結束: 13:34:57.400674391

Bug 2: Grep Invalid Regex

  1. Use Grep tool with pattern: [invalid regex (((
  2. Observe response: "No files found" (misleading)

Comparison with ripgrep directly:

$ rg "[invalid regex (((" /path
error: regex parse error:
    [invalid regex (((
                    ^
error: unclosed group

Bug 3: Read Negative Offset

  1. Use Read tool with offset=-5 on any file
  2. Observe output shows negative line numbers:
    -5→Test file for Read tool
    -4→

Claude Code Version

Claude for Mac Version 1.0.3218 (8679c9)


Is this a regression?

I don't know


Platform

Other (Claude for Mac - Cowork/Sandbox mode)


Operating System

macOS


Terminal/Shell

Claude for Mac (native app)


Error Messages/Logs

Bug 1 - No error, just unexpected sequential timing

Bug 2 - Misleading "No files found" instead of regex parse error

Bug 3 - No error, invalid output with negative line numbers


Impact Summary

Bug Severity Impact
Parallel Execution Medium 5x performance degradation
Grep Error Handling Low User confusion, wasted debugging time
Read Negative Offset Low Invalid output, poor input validation

Suggested Fixes

  1. Parallel Execution: Enable concurrent tool execution or clarify documentation
  2. Grep Error Handling: Surface ripgrep's error messages to users
  3. Read Validation: Add "minimum": 0 constraint to offset parameter schema

Reporter: Claude Code Community Testing
Date: 2026-01-13

gn00295120 avatar Jan 13 '26 13:01 gn00295120