Skip to content

Docker Sandbox file sync corrupts git index, causing git segfault #62

@OneRedOak

Description

@OneRedOak

Bug report

When using Docker Sandboxes with Claude Code, the file sync mechanism corrupted my git repository's index file, causing git status to segfault.

Environment:

Steps to reproduce:

  1. Set up ANTHROPIC_API_KEY in ~/.zshrc and restart Docker Desktop
  2. Create a sandbox for an existing git repository:
    docker sandbox run claude ~/Engineering/dashboard
  3. Work in the sandbox (or even just start it)
  4. Attempt to run git status on the host machine in the same directory

Expected behavior: git status should work normally on the host, showing any changes made by the sandbox agent.

Actual behavior:

git status
[1]    89564 segmentation fault  git status
  • git log still works (object database intact)
  • git status crashes with segfault
  • GitHub Desktop also fails with: Command failed: git --no-optional-locks status --untracked-files=all --branch --porcelain=2 -z

Workaround: Removing and rebuilding the git index fixes the issue:

rm .git/index
git reset

Analysis: The git index (.git/index) is a binary file that tracks working directory state. The bidirectional file sync between host and sandbox VM likely caused:

  • A race condition with concurrent writes
  • A partial/interrupted write during sync
  • Metadata inconsistency that crashes git when stat'ing files

Additional notes:

  • Also encountered sync credentials: sync credentials failed: status 404: {"message":"Not Found"} errors during sandbox creation (unrelated, caused by no Anthropic API key present, but worth noting)
  • The sandbox otherwise created and ran successfully

Platform

macOS

Version information

Client:
 Version:           29.1.5
 API version:       1.52
 Go version:        go1.25.6
 Git commit:        0e6fee6
 Built:             Fri Jan 16 12:47:44 2026
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.58.1 (217134)
 Engine:
  Version:          29.1.5
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.6
  Git commit:       3b01d64
  Built:            Fri Jan 16 12:48:37 2026
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v2.2.1
  GitCommit:        dea7da592f5d1d2b7755e3a161be07f43fad8f75
 runc:
  Version:          1.3.4
  GitCommit:        v1.3.4-0-gd6d73eb8
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Client:
 Version:    29.1.5
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.17.1
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.1-desktop.2
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.0.1
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.47
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.2.0
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-desktop
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.31
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.35.0
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-mcp
  model: Docker Model Runner (Docker Inc.)
    Version:  v1.0.7
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-model
  offload: Docker Offload (Docker Inc.)
    Version:  v0.5.41
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-offload
  pass: Docker Pass Secrets Manager Plugin (beta) (Docker Inc.)
    Version:  v0.0.22
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-pass
  sandbox: Docker Sandbox (Docker Inc.)
    Version:  v0.10.1
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-sandbox
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.19.0
    Path:     /Users/patrickellis/.docker/cli-plugins/docker-scout

Server:
 Containers: 20
  Running: 14
  Paused: 0
  Stopped: 6
 Images: 81
 Server Version: 29.1.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Discovered Devices:
  cdi: docker.com/gpu=webgpu
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.65-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 6.277GiB
 Name: docker-desktop
 ID: 82a7e331-89e9-48c7-8cbd-f2abf5421d64
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/patrickellis/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables

Diagnostics ID

FFB2FD8B-A6F1-4D3F-AE7A-869B1E80809F/20260203024616

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions