{"record":{"id":"f13a32c740f33341","repo":"gastownhall/beads","slug":"database-q-has-no-project-identity-metadata-pro","errorCode":null,"errorMessage":"database %q has no project identity (metadata._project_id) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')","messagePattern":"database %q has no project identity \\(metadata\\._project_id\\) — provision it with 'bts init' \\(or heal an older bts database with 'bts migrate'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_proxied_server.go","lineNumber":438,"sourceCode":"\t\tif readErr == nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\n\t\t\t\t\"database %q has no project identity (config.issue_prefix) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')\",\n\t\t\t\tdbName)\n\t\t}\n\t\treturn \"\", \"\", err\n\t}\n\t// An explicit --prefix that disagrees must not be silently ignored; a\n\t// merely derived prefix adopts silently.\n\tif prefixIsExplicit && identity.Prefix != localPrefix {\n\t\treturn \"\", \"\", fmt.Errorf(\n\t\t\t\"--prefix %q conflicts with issue_prefix %q provisioned in database %q; omit --prefix to adopt the provisioned one\",\n\t\t\tlocalPrefix, identity.Prefix, dbName)\n\t}\n\n\tadoptedID, _, err := resolveInitProjectID(true, localProjectID, identity.ProjectID, dbName, readErr)\n\tif err != nil {\n\t\tif readErr == nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\n\t\t\t\t\"database %q has no project identity (metadata._project_id) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')\",\n\t\t\t\tdbName)\n\t\t}\n\t\treturn \"\", \"\", err\n\t}\n\treturn identity.Prefix, adoptedID, nil\n}\n\ntype proxiedMetadataInputs struct {\n\tdbName     string\n\tprojectID  string\n\tteamServer bool\n}\n\nfunc composeProxiedServerMetadataJSON(in proxiedMetadataInputs) ([]byte, error) {\n\tcfg := configfile.DefaultConfig()\n\tcfg.Backend = configfile.BackendDolt\n\tcfg.Database = \"dolt\"","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_proxied_server.go#L420-L456","documentation":"Companion to the issue_prefix error: after resolving the prefix, adoptTeamServerIdentity resolves the project ID. When VerifyIdentity succeeds but the identity snapshot has no metadata._project_id, bd hard-errors because team-server mode requires the bts-provisioned project id and bd never writes identity itself.","triggerScenarios":"bd init against a team-server database whose provisioned identity includes config.issue_prefix but lacks metadata._project_id — partially provisioned database, or an older bts database that predates project-id provisioning.","commonSituations":"A bts init that partially failed (prefix written, project id not); legacy shared databases needing 'bts migrate'; pointing at the wrong partially-set-up database.","solutions":["Run 'bts migrate' to heal the older/partially provisioned database (the error's recommended remedy)","If the database was never set up, run 'bts init' to provision identity fully","Re-run bd init after provisioning and verify with bts tooling that _project_id exists"],"exampleFix":"// before\nerr: database \"bd_team\" has no project identity (metadata._project_id)\n// after\nbts migrate --database bd_team   # heal legacy db\nbd init","handlingStrategy":"validation","validationCode":"// confirm full identity (prefix AND project id) before bd init\nident, err := verifier.VerifyIdentity(ctx, issueops.VerifyIdentityRequest{})\nif err == nil && ident.Prefix != \"\" && ident.ProjectID == \"\" {\n    return errors.New(\"identity half-provisioned; run 'bts migrate' to heal\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"has no project identity (metadata._project_id)\") {\n    // run 'bts migrate' (or 'bts init'), verify identity, then retry bd init\n}","preventionTips":["After any bts init, verify both prefix and _project_id were written","Run 'bts migrate' on legacy shared databases before bd init","Treat partial provisioning as broken: re-provision rather than working around","Verify the database name points at the intended provisioned db"],"tags":["init","identity","project-id","team-server","unprovisioned-database","bts"],"backgroundTag":"unprovisioned-team-server-database","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}