Skip to content

[BUG] .claude.json is trucated directly, and so occasionally gets corrupted #2593

@max-sixty

Description

@max-sixty

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version: 1.0.35
  • Operating System: macOS
  • Terminal: Alacritty

Bug Description

I occasionally get my .claude.json wiped. I think that's happening because claude truncates it directly when writing an edit. and so if one process hasn't completed writing when another attempts to read, it'll get a corrupted file, and then wipes the whole thing

this becomes really evident when mounting it as a file to a container; if lots of claudes are running, and .claude.json is large, the container is fairly likely to get less than a full file given docker's mount performance

Expected Behavior

have claude do an atomic rename of .claude.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions