{"record":{"id":"c213ae0b65b4a951","repo":"gastownhall/beads","slug":"resolve-backend-root-identity-w","errorCode":null,"errorMessage":"resolve backend root identity: %w","messagePattern":"resolve backend root identity: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/proxy/endpoint.go","lineNumber":807,"sourceCode":"\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif probeErr != nil {\n\t\t\terr = errors.Join(err, fmt.Errorf(\"probe recorded pid: %w\", probeErr))\n\t\t}\n\t\treturn unverifiableProcessError(\n\t\t\t\"backend cleanup\",\n\t\t\trecordPath,\n\t\t\tpf.Pid,\n\t\t\terr,\n\t\t\tunverifiableProcessChecks{\n\t\t\t\tLiveEstablished: live,\n\t\t\t},\n\t\t)\n\t}\n\texpectedRootID, err := identity.RootID(rootDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolve backend root identity: %w\", err)\n\t}\n\tif pf.RootID != expectedRootID {\n\t\treturn unverifiableProcessError(\n\t\t\t\"backend cleanup\",\n\t\t\trecordPath,\n\t\t\tpf.Pid,\n\t\t\tfmt.Errorf(\"root identity mismatch (record has %q, workspace has %q)\", pf.RootID, expectedRootID),\n\t\t\tunverifiableProcessChecks{},\n\t\t)\n\t}\n\n\thandle, dead, err := openRecordedProcess(pf)\n\tif err != nil {\n\t\treturn unverifiableProcessError(\n\t\t\t\"backend cleanup\",\n\t\t\trecordPath,\n\t\t\tpf.Pid,\n\t\t\terr,","sourceCodeStart":789,"sourceCodeEnd":825,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/endpoint.go#L789-L825","documentation":"After the backend record validates, cleanup compares the record's RootID against the workspace's current root identity (identity.RootID(rootDir)). This error wraps a failure to compute that workspace identity — cleanup cannot safely proceed without it, so it aborts before touching any process.","triggerScenarios":"identity.RootID(rootDir) returns an error during cleanupOrphanBackend at internal/storage/dbproxy/proxy/endpoint.go:805-807 — typically the workspace root metadata needed to derive the identity is missing or unreadable.","commonSituations":"Running the command outside a properly initialized bd workspace; the workspace root metadata file was deleted or corrupted; wrong rootDir passed (e.g. running from a subdirectory with a misconfigured path); permissions on the root identity file.","solutions":["Run bd from the workspace root and verify the workspace is initialized (bd doctor).","Restore or re-create the missing workspace root metadata; if the workspace is disposable, re-init it.","Check read permissions on the workspace root identity file and fix them.","Verify the path/rootDir configuration points at the intended workspace."],"exampleFix":"// before\nError: resolve backend root identity: open /ws/.beads/root-id: no such file or directory\n// after\n$ cd /ws && bd doctor   # or re-init the workspace to restore root metadata","handlingStrategy":"validation","validationCode":"if _, err := identity.RootID(rootDir); err != nil {\n    return fmt.Errorf(\"workspace root identity missing/corrupt, run bd doctor or re-init: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := cleanupOrphanBackend(rootDir); err != nil && strings.Contains(err.Error(), \"resolve backend root identity\") {\n    // recover by re-initializing workspace metadata, then retry\n    _ = reinitWorkspaceMetadata(rootDir)\n    err = cleanupOrphanBackend(rootDir)\n}","preventionTips":["Always run bd from the workspace root.","Do not delete .beads metadata files selectively.","Restore whole workspaces, not individual metadata files.","Verify workspace initialization after cloning or moving projects."],"tags":["go","workspace-identity","root-id","filesystem"],"backgroundTag":"workspace-identity-unresolvable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}