{"record":{"id":"57d2dad1440c79f2","repo":"gastownhall/beads","slug":"global-project-identity-mismatch-refusing-to-con","errorCode":null,"errorMessage":"GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect\n\n  Expected global project ID (metadata.json): %s\n  Database project ID:                        %s\n\n","messagePattern":"GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect\n\n  Expected global project ID \\(metadata\\.json\\): (.+?)\n  Database project ID:                        (.+?)\n\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/storage/dolt/store.go","lineNumber":2159,"sourceCode":"\t\treturn nil\n\t}\n\n\tmetaCfg, err := configfile.Load(beadsDir)\n\tif err != nil || metaCfg == nil {\n\t\treturn nil\n\t}\n\texpectedID := metaCfg.GlobalProjectID\n\tif expectedID == \"\" {\n\t\treturn nil\n\t}\n\n\tdbID, err := s.GetMetadata(ctx, \"_project_id\")\n\tif err != nil || dbID == \"\" {\n\t\treturn nil\n\t}\n\n\tif expectedID != dbID {\n\t\treturn fmt.Errorf(\n\t\t\t\"GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect\\n\\n\"+\n\t\t\t\t\"  Expected global project ID (metadata.json): %s\\n\"+\n\t\t\t\t\"  Database project ID:                        %s\\n\\n\"+\n\t\t\t\texpectedID, dbID)\n\t}\n\treturn nil\n}\n\n// isLocalHost returns true if the host refers to the local machine.\nfunc isLocalHost(host string) bool {\n\tswitch host {\n\tcase \"\", \"127.0.0.1\", \"localhost\", \"::1\", \"[::1]\":\n\t\treturn true\n\t}\n\treturn false\n}\n\n// isExternalServerHost reports whether host names a remote server for the","sourceCodeStart":2141,"sourceCodeEnd":2177,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/store.go#L2141-L2177","documentation":"Global-variant identity guard: verifies the database's project ID matches the expected GLOBAL project ID from metadata.json before connecting. Returns nil if the DB has no stored project ID (first connect) so a fresh database can be stamped. On mismatch it refuses to connect to avoid contaminating a shared/global database with another project's data.","triggerScenarios":"Connecting with global-store expectations where GetMetadata(ctx, \"_project_id\") yields a non-empty value different from expectedID.","commonSituations":"A per-project database is mounted where the global store is expected; global server re-pointed at another project's data dir; copied .beads directory retains old project ID.","solutions":["Run bd dolt status to inspect the served database","Point the global store at the correct database/data dir","If the database is genuinely stale/misplaced, re-init the correct global DB and restore data from backup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"expectedGlobalID := readProjectIDFromMetadata(\".beads/metadata.json\")\ndbID, err := store.GetMetadata(ctx, \"_project_id\")\nif err == nil && dbID != \"\" && dbID != expectedGlobalID {\n    return fmt.Errorf(\"global identity mismatch: expected=%s got=%s\", expectedGlobalID, dbID)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"GLOBAL PROJECT IDENTITY MISMATCH\") {\n        // repoint global store config at correct DB\n    }\n    return err\n}","preventionTips":["Keep global store pointed at its dedicated database","Don't copy project .beads dirs into global paths","Verify identity after any data-dir move","Audit global server config on upgrades"],"tags":["configuration","identity","global-store","dolt"],"backgroundTag":"project-identity-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}