{"record":{"id":"8152008f86f3faea","repo":"gastownhall/beads","slug":"record-bd-version-w","errorCode":null,"errorMessage":"record bd_version: %w","messagePattern":"record bd_version: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_proxied_server.go","lineNumber":383,"sourceCode":"\t\tcfg := uw.ConfigUseCase()\n\t\t// An absent fingerprint is recorded as nothing rather than as \"\": an\n\t\t// empty row reads back to cross-project verification as a clone whose\n\t\t// fingerprint failed to compute.\n\t\tif repoID != \"\" {\n\t\t\tif err := cfg.SetMetadata(ctx, \"repo_id\", repoID); err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"record repo_id: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif cloneID != \"\" {\n\t\t\tif err := cfg.SetMetadata(ctx, \"clone_id\", cloneID); err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"record clone_id: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif err := cfg.SetMetadata(ctx, \"last_import_time\", time.Now().UTC().Format(time.RFC3339)); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"record last_import_time: %w\", err)\n\t\t}\n\t\tif err := cfg.SetLocalMetadata(ctx, workapi.MetadataKeyVersion, Version); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"record bd_version: %w\", err)\n\t\t}\n\t\treturn \"bd init\", nil\n\t})\n}\n\n// configureProxiedInitDoltRemote adds the sync remote, skipping a name that is\n// already taken.\nfunc configureProxiedInitDoltRemote(ctx context.Context, provider uow.UnitOfWorkProvider, remoteURL string) error {\n\treturn uow.RunTx(ctx, provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) {\n\t\tremotes, err := uw.DoltRemoteUseCase().ListRemotes(ctx)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"list remotes: %w\", err)\n\t\t}\n\t\tfor _, r := range remotes {\n\t\t\tif r.Name == \"origin\" {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t}","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_proxied_server.go#L365-L401","documentation":"Wraps failure of cfg.SetLocalMetadata(ctx, workapi.MetadataKeyVersion, Version) — recording the bd binary version in LOCAL (clone-only) metadata during proxied init. Unlike the shared metadata keys, this one is per-clone, so failure points at the local side of the store. The wrapped error is the actual cause.","triggerScenarios":"bd init in team-server mode where the local metadata write of the bd version fails — local .bd metadata store corrupted, disk full, or local transaction failure after the shared writes succeeded.","commonSituations":"Corrupted or partially-migrated local metadata file; read-only working directory or filesystem; running init from a container with a read-only mount.","solutions":["Check the local working directory is writable (mounts, permissions, disk space)","Inspect/repair the local .bd metadata store (bd doctor) and re-run bd init","Read the wrapped underlying error for the storage-level cause"],"exampleFix":"// before\nerr: \"record bd_version: permission denied\"\nchmod u+w .bd  # or fix the read-only mount\n// after\nbd init","handlingStrategy":"validation","validationCode":"// ensure the local .bd store is writable before init\ninfo, err := os.Stat(filepath.Join(root, \".bd\"))\nif err == nil && info.IsDir() {\n    if f, e := os.CreateTemp(filepath.Join(root, \".bd\"), \"w\"); e != nil {\n        return fmt.Errorf(\".bd not writable: %w\", e)\n    } else { f.Close(); os.Remove(f.Name()) }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"record bd_version:\") {\n    log.Printf(\"local metadata write failed: %v\", errors.Unwrap(err))\n    // check filesystem permissions/mounts, run bd doctor, retry\n}","preventionTips":["Run bd init from a writable working directory/mount","Check disk space before init in CI containers","Run bd doctor if local metadata may be corrupted","Don't run init against read-only checkouts"],"tags":["init","metadata","version","local-state","persistence"],"backgroundTag":"metadata-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}