{"record":{"id":"76535447e3419c19","repo":"gastownhall/beads","slug":"failed-to-fingerprint-target-changes-w","errorCode":null,"errorMessage":"failed to fingerprint target changes: %w","messagePattern":"failed to fingerprint target changes: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/worktree_cmd.go","lineNumber":1036,"sourceCode":"\tgitMarkerPath := filepath.Join(worktree.path, \".git\")\n\tgitMarkerInfo, err := os.Lstat(gitMarkerPath)\n\tif err != nil {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"failed to pin target git marker identity: %w\", err)\n\t}\n\tif gitMarkerInfo.Mode()&os.ModeSymlink != 0 || !gitMarkerInfo.Mode().IsRegular() {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"target git marker is not a regular file: %s\", gitMarkerPath)\n\t}\n\tgitDirFingerprint, err := fingerprintWorktreeFilesystem(gitDir)\n\tif err != nil {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"failed to fingerprint target git directory: %w\", err)\n\t}\n\tgitMarkerFingerprint, err := fingerprintWorktreeFilesystem(gitMarkerPath)\n\tif err != nil {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"failed to fingerprint target git marker: %w\", err)\n\t}\n\tstatusFingerprint, err := fingerprintWorktreeStatusPaths(worktree.path, string(statusOutput))\n\tif err != nil {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"failed to fingerprint target changes: %w\", err)\n\t}\n\n\treturn pinnedWorktreeTarget{\n\t\tpath:                 filepath.Clean(worktree.path),\n\t\tpathInfo:             pathInfo,\n\t\tgitDir:               gitDir,\n\t\tgitDirInfo:           gitDirInfo,\n\t\tgitMarkerInfo:        gitMarkerInfo,\n\t\tgitDirFingerprint:    gitDirFingerprint,\n\t\tgitMarkerFingerprint: gitMarkerFingerprint,\n\t\tcommonDir:            filepath.Clean(strings.TrimSpace(string(commonDirOutput))),\n\t\theadOID:              headOID,\n\t\tbranch:               worktree.branch,\n\t\tdetached:             worktree.detached,\n\t\tbare:                 worktree.bare,\n\t\tlocked:               worktree.locked,\n\t\tlockReason:           worktree.lockReason,\n\t\tprunable:             worktree.prunable,","sourceCodeStart":1018,"sourceCodeEnd":1054,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/worktree_cmd.go#L1018-L1054","documentation":"To detect uncommitted changes, bd hashes the contents of every path reported dirty by `git status --porcelain=v1 -z`. This error wraps failures from walking/hashing those changed files (permissions, concurrent deletion, stat errors) — missing files are tolerated (`<missing>`), but other I/O failures abort.","triggerScenarios":"`bd worktree remove <name>` without --force when a modified/untracked file listed by `git status` cannot be read: permission denied, unreadable symlink target handling, or transient I/O failures during the walk.","commonSituations":"Root-owned or 000-permission modified files; files locked by another process (Windows editors, AV); sparse-checkout entries with odd permissions; FUSE mount errors on untracked files.","solutions":["Fix read permissions on the changed files: `chmod -R u+rwX <worktree>`","Commit or discard the changes first (`git add -A && git commit` or `git checkout -- .`), then remove with a clean status","If you accept data loss, use the force flag to bypass the cleanliness fingerprint entirely"],"exampleFix":"// before: unreadable modified file blocks fingerprint\nchmod u+rw src/main.go\n// after\nbd worktree remove mywt","handlingStrategy":"validation","validationCode":"// every dirty path should be readable before removal\nout, _ := exec.Command(\"git\", \"-C\", wt, \"status\", \"--porcelain=v1\", \"-z\").Output()\nfor _, p := range strings.Split(string(out), \"\\x00\") {\n    if len(p) > 3 {\n        if _, err := os.Stat(filepath.Join(wt, p[3:])); err != nil && !os.IsNotExist(err) {\n            return fmt.Errorf(\"unreadable changed file %s: %w\", p[3:], err)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit or stash changes before worktree removal to keep the dirty set empty","Ensure all repo files are readable by the user running bd","Use the force flag only when you accept losing unreadable local changes"],"tags":["git","worktree","permissions"],"backgroundTag":"filesystem-fingerprint-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}