gastownhall/beads · error

database %q has no project identity (metadata._project_id) —

Error message

database %q has no project identity (metadata._project_id) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')

What it means

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.

Source

Thrown at cmd/bd/init_proxied_server.go:438

		if readErr == nil {
			return "", "", fmt.Errorf(
				"database %q has no project identity (config.issue_prefix) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')",
				dbName)
		}
		return "", "", err
	}
	// An explicit --prefix that disagrees must not be silently ignored; a
	// merely derived prefix adopts silently.
	if prefixIsExplicit && identity.Prefix != localPrefix {
		return "", "", fmt.Errorf(
			"--prefix %q conflicts with issue_prefix %q provisioned in database %q; omit --prefix to adopt the provisioned one",
			localPrefix, identity.Prefix, dbName)
	}

	adoptedID, _, err := resolveInitProjectID(true, localProjectID, identity.ProjectID, dbName, readErr)
	if err != nil {
		if readErr == nil {
			return "", "", fmt.Errorf(
				"database %q has no project identity (metadata._project_id) — provision it with 'bts init' (or heal an older bts database with 'bts migrate')",
				dbName)
		}
		return "", "", err
	}
	return identity.Prefix, adoptedID, nil
}

type proxiedMetadataInputs struct {
	dbName     string
	projectID  string
	teamServer bool
}

func composeProxiedServerMetadataJSON(in proxiedMetadataInputs) ([]byte, error) {
	cfg := configfile.DefaultConfig()
	cfg.Backend = configfile.BackendDolt
	cfg.Database = "dolt"

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run 'bts migrate' to heal the older/partially provisioned database (the error's recommended remedy)
  2. If the database was never set up, run 'bts init' to provision identity fully
  3. Re-run bd init after provisioning and verify with bts tooling that _project_id exists

Example fix

// before
err: database "bd_team" has no project identity (metadata._project_id)
// after
bts migrate --database bd_team   # heal legacy db
bd init
Defensive patterns

Strategy: validation

Validate before calling

// confirm full identity (prefix AND project id) before bd init
ident, err := verifier.VerifyIdentity(ctx, issueops.VerifyIdentityRequest{})
if err == nil && ident.Prefix != "" && ident.ProjectID == "" {
    return errors.New("identity half-provisioned; run 'bts migrate' to heal")
}

Try / catch

if err != nil && strings.Contains(err.Error(), "has no project identity (metadata._project_id)") {
    // run 'bts migrate' (or 'bts init'), verify identity, then retry bd init
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/f13a32c740f33341. Report an issue: GitHub.