{"record":{"id":"bde88b14e0448be2","repo":"gastownhall/beads","slug":"s-bde88b","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/dolt_autopush.go","lineNumber":33,"sourceCode":")\n\n// pushState tracks auto-push state in a local file (.beads/push-state.json)\n// instead of the Dolt metadata table, to avoid merge conflicts on multi-machine\n// setups (GH#2466).\ntype pushState struct {\n\tLastPush   string `json:\"last_push\"`   // RFC3339 timestamp\n\tLastCommit string `json:\"last_commit\"` // Dolt commit hash\n}\n\ntype autoPushTarget interface {\n\tGetCurrentCommit(ctx context.Context) (string, error)\n\tPush(ctx context.Context) error\n}\n\nfunc pushStatePath() (string, error) {\n\tbeadsDir := beads.FindBeadsDir()\n\tif beadsDir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"%s\", activeWorkspaceNotFoundError())\n\t}\n\treturn filepath.Join(beadsDir, \"push-state.json\"), nil\n}\n\nfunc loadPushState() (*pushState, error) {\n\tpath, err := pushStatePath()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, err := os.ReadFile(path) //nolint:gosec // path is constructed internally\n\tif os.IsNotExist(err) {\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ps pushState\n\tif err := json.Unmarshal(data, &ps); err != nil {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dolt_autopush.go#L15-L51","documentation":"pushStatePath returns this error when beads.FindBeadsDir() cannot locate a .beads directory for the current workspace. The Dolt auto-push feature needs a place to store push-state.json, and without a beads workspace there is nowhere to put it. The message text comes from activeWorkspaceNotFoundError(), so the actual explanation is the workspace-not-found family.","triggerScenarios":"Running a command that triggers loadPushState/savePushState (auto-push) outside any directory hierarchy containing a .beads directory, or when BD_* env overrides point at a missing location.","commonSituations":"Running bd from a fresh clone without bd init; running from an unrelated directory with the wrong cwd; CI job checking out only part of the repo so .beads is absent.","solutions":["Run bd init in the repository to create the .beads workspace","cd into the repository root (or a subdirectory of it) so FindBeadsDir can walk up to .beads","Set the beads directory env override explicitly if the workspace lives elsewhere"],"exampleFix":"// before (run in ~/tmp, no .beads)\nbd push\n// after\ncd ~/my-repo && bd init && bd push","handlingStrategy":"validation","validationCode":"if beads.FindBeadsDir() == \"\" {\n    return errors.New(\"not in a beads workspace: run 'bd init'\")\n}","typeGuard":null,"tryCatchPattern":"path, err := pushStatePath()\nif err != nil {\n    return fmt.Errorf(\"cannot persist push state (run bd init first): %w\", err)\n}","preventionTips":["Always run bd init after cloning a repository","Run bd commands from inside the repo so FindBeadsDir can walk up to .beads","In CI, assert the .beads directory exists before invoking push-dependent commands"],"tags":["workspace","beads-dir","push-state","environment"],"backgroundTag":"beads-workspace-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}