{"record":{"id":"0fbe59735879d0ff","repo":"gastownhall/beads","slug":"failed-to-fingerprint-target-git-marker-w","errorCode":null,"errorMessage":"failed to fingerprint target git marker: %w","messagePattern":"failed to fingerprint target git marker: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/worktree_cmd.go","lineNumber":1032,"sourceCode":"\t}\n\tif gitDirInfo.Mode()&os.ModeSymlink != 0 || !gitDirInfo.IsDir() {\n\t\treturn pinnedWorktreeTarget{}, fmt.Errorf(\"target git directory is not a real directory: %s\", gitDir)\n\t}\n\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,","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/worktree_cmd.go#L1014-L1050","documentation":"bd fingerprints the worktree's `.git` marker file (same walk/hash routine as the gitdir) so removal can verify the target did not change between plan and execution. This error wraps any failure reading or hashing that file.","triggerScenarios":"`bd worktree remove <name>` or observeRevalidation when opening or reading `<worktree>/.git` fails: permission denied, deleted mid-scan, or I/O error.","commonSituations":"Read-only worktree mounts; the marker deleted by another process (e.g. `git worktree prune`) while bd read it; FUSE/network filesystem hiccups.","solutions":["Check the file is readable: `cat <worktree>/.git`; fix permissions if needed","Re-run `git worktree repair` and retry the removal","Retry the command if another git process was running concurrently"],"exampleFix":"// before: marker unreadable (mode 000)\nchmod u+r <worktree>/.git\n// after\nbd worktree remove mywt","handlingStrategy":"retry","validationCode":"if _, err := os.ReadFile(filepath.Join(worktreePath, \".git\")); err != nil {\n    return fmt.Errorf(\"marker unreadable before removal: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(err, fs.ErrPermission) || os.IsNotExist(err) {\n        // re-check git worktree list / repair, then retry\n    }\n}","preventionTips":["Keep worktree mounts writable by the invoking user","Serialize bd worktree commands with other git worktree operations","Repair registrations after moving repos: `git worktree repair`"],"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"}