gastownhall/beads · critical

GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect Ex

Error message

GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect

  Expected global project ID (metadata.json): %s
  Database project ID:                        %s

What it means

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.

Source

Thrown at internal/storage/dolt/store.go:2159

		return nil
	}

	metaCfg, err := configfile.Load(beadsDir)
	if err != nil || metaCfg == nil {
		return nil
	}
	expectedID := metaCfg.GlobalProjectID
	if expectedID == "" {
		return nil
	}

	dbID, err := s.GetMetadata(ctx, "_project_id")
	if err != nil || dbID == "" {
		return nil
	}

	if expectedID != dbID {
		return fmt.Errorf(
			"GLOBAL PROJECT IDENTITY MISMATCH — refusing to connect\n\n"+
				"  Expected global project ID (metadata.json): %s\n"+
				"  Database project ID:                        %s\n\n"+
				expectedID, dbID)
	}
	return nil
}

// isLocalHost returns true if the host refers to the local machine.
func isLocalHost(host string) bool {
	switch host {
	case "", "127.0.0.1", "localhost", "::1", "[::1]":
		return true
	}
	return false
}

// isExternalServerHost reports whether host names a remote server for the

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run bd dolt status to inspect the served database
  2. Point the global store at the correct database/data dir
  3. If the database is genuinely stale/misplaced, re-init the correct global DB and restore data from backup
Defensive patterns

Strategy: validation

Validate before calling

expectedGlobalID := readProjectIDFromMetadata(".beads/metadata.json")
dbID, err := store.GetMetadata(ctx, "_project_id")
if err == nil && dbID != "" && dbID != expectedGlobalID {
    return fmt.Errorf("global identity mismatch: expected=%s got=%s", expectedGlobalID, dbID)
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "GLOBAL PROJECT IDENTITY MISMATCH") {
        // repoint global store config at correct DB
    }
    return err
}

Prevention

When it happens

Trigger: Connecting with global-store expectations where GetMetadata(ctx, "_project_id") yields a non-empty value different from expectedID.

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

Related errors


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