claude-code - 💡(How to fix) Fix [MODEL] Parallel file reads lose filename-to-content association, causing silent data swap

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

    1. No warning or uncertainty was flagged for these specific files. The error was only caught when the user manually verified.

Root Cause

  1. Claude read all 30 PDFs in batches of 10 using parallel Read tool calls.
    1. Claude correctly extracted the date, litres, and amount from every receipt.
    1. For most files, Claude successfully matched content back to filenames because the date prefix in the existing filename matched the receipt date.
    1. However, 4 files shared the same date prefix (2026-04-19_*) because they were scanned on the same day but contained receipts from different dates. Two of these were both Costco gas receipts.
    1. Claude had to guess which rendered PDF document came from which file — and guessed wrong for the two Costco receipts.
    1. Result: the two files were renamed with each other's data — a perfect silent swap of date, litres, and amount between the two files.
    1. No warning or uncertainty was flagged for these specific files. The error was only caught when the user manually verified.

Code Example



---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude made incorrect assumptions about my project

What You Asked Claude to Do

I asked Claude Code to rename 30 scanned PDF gas receipts based on their content. Each PDF contains a gas station receipt with date, litres, and dollar amount. Claude should read each PDF, extract the data, and rename the file to the format <date>_<litres>_$<amount>.pdf.

What Claude Actually Did

  1. Claude read all 30 PDFs in batches of 10 using parallel Read tool calls.
    1. Claude correctly extracted the date, litres, and amount from every receipt.
    1. For most files, Claude successfully matched content back to filenames because the date prefix in the existing filename matched the receipt date.
    1. However, 4 files shared the same date prefix (2026-04-19_*) because they were scanned on the same day but contained receipts from different dates. Two of these were both Costco gas receipts.
    1. Claude had to guess which rendered PDF document came from which file — and guessed wrong for the two Costco receipts.
    1. Result: the two files were renamed with each other's data — a perfect silent swap of date, litres, and amount between the two files.
    1. No warning or uncertainty was flagged for these specific files. The error was only caught when the user manually verified.

Expected Behavior

When multiple files are read in parallel via the Read tool, the returned document content should maintain a clear, programmatic association with the source filename. The model should not have to guess which rendered content belongs to which file.

Alternatively, for content-dependent operations (like rename-by-content), Claude should process files sequentially — read one file, act on it, then read the next — rather than reading in parallel batches where the content-to-filename link is lost.

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Haven't tried to reproduce

Steps to Reproduce

No response

Claude Model

Opus

Relevant Conversation

Impact

Medium - Extra work to undo changes

Claude Code Version

2.1.116 (Claude Code)

Platform

Anthropic API

Additional Context

No response

extent analysis

TL;DR

Process files sequentially instead of in parallel batches to maintain a clear association between the rendered content and the source filename.

Guidance

  • When using the Read tool, consider processing files one by one to avoid losing the content-to-filename link, especially for content-dependent operations like renaming files based on their content.
  • Review the Claude Code documentation to see if there are any configuration options or parameters that can be adjusted to prioritize sequential processing over parallel batches.
  • Test the sequential processing approach with a small set of files to verify that it resolves the issue before applying it to the entire set of 30 PDFs.
  • Consider implementing a validation step after renaming files to detect and flag any potential mismatches or errors.

Example

No code snippet is provided as the issue does not contain sufficient technical details to generate a specific example.

Notes

The provided information suggests that the issue is related to the parallel processing of files, but the exact implementation details are not available. Therefore, the suggested solution focuses on changing the processing approach rather than modifying specific code.

Recommendation

Apply workaround: Process files sequentially to avoid content-to-filename link loss. This approach is recommended because it directly addresses the identified issue and can be implemented without requiring additional information or modifications to the underlying code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING