{"record":{"id":"4634f8580a49bb2d","repo":"gastownhall/beads","slug":"fetch-from-s-s-w","errorCode":null,"errorMessage":"fetch from %s/%s: %w","messagePattern":"fetch from (.+?)/(.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/store.go","lineNumber":4404,"sourceCode":"\t\treturn pullReport{}, fmt.Errorf(\"failed to set dolt_force_transaction_commit: %w\", err)\n\t}\n\n\t// DOLT_PULL's row is the engine's only in-band account of what the pull\n\t// did: `dolt pull` on the CLI exits 0 whether it merged or was already up\n\t// to date, and so does this CALL. Capturing it costs nothing — the drain\n\t// is identical — and it is the difference between a caller that knows\n\t// nothing arrived and one that only knows no error occurred (ga-bq9zd).\n\tpullRow, pullErr := schema.CallReturningRow(ctx, tx, query, args...)\n\treport := parseMergeReport(pullRow)\n\n\t// GH#3144: When DOLT_PULL fails because upstream branch tracking is not\n\t// configured in repo_state.json (common when remote was added via\n\t// bd dolt remote add rather than bd bootstrap/dolt clone), fall back to\n\t// DOLT_FETCH + DOLT_MERGE which does not require tracking config.\n\tif pullErr != nil && isBranchTrackingError(pullErr) {\n\t\tif err := schema.DrainCall(ctx, tx, \"CALL DOLT_FETCH(?, ?)\", remote, s.branch); err != nil {\n\t\t\t_ = tx.Rollback()\n\t\t\treturn pullReport{}, fmt.Errorf(\"fetch from %s/%s: %w\", remote, s.branch, err)\n\t\t}\n\t\ttrackingRef := remote + \"/\" + s.branch\n\t\t// The merge, not the pull, is now what happened — so its row replaces\n\t\t// the failed pull's report rather than adding to it.\n\t\tmergeRow, mergeErr := schema.CallReturningRow(ctx, tx, \"CALL DOLT_MERGE(?)\", trackingRef)\n\t\treport = parseMergeReport(mergeRow)\n\t\t// Retained deliberately even though DOLT_MERGE reports the ordinary\n\t\t// no-op as a MESSAGE with a nil error (measured: \"Everything\n\t\t// up-to-date\" and \"cannot fast forward from a to b. a is ahead of b\n\t\t// already\" both arrive that way). Dolt's squash path still returns\n\t\t// \"Already up to date.\" as a real error, and that is what this catches.\n\t\tif mergeErr != nil && strings.Contains(mergeErr.Error(), \"up to date\") {\n\t\t\tmergeErr = nil\n\t\t}\n\t\tpullErr = mergeErr\n\t}\n\n\treturn report, s.settleMergeInTx(ctx, tx, pullErr)","sourceCodeStart":4386,"sourceCodeEnd":4422,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/store.go#L4386-L4422","documentation":"Wraps a failure of `CALL DOLT_FETCH(?, ?)` executed as a fallback when DOLT_PULL fails with a branch-tracking error (the branch has no upstream tracking config in repo_state.json). The fetch is retried without tracking config, and if even the fetch fails the error is wrapped with the remote and branch for identification.","triggerScenarios":"DOLT_PULL returns a branch-tracking error, bd falls back to DOLT_FETCH + DOLT_MERGE, and DOLT_FETCH fails — typically because the remote name does not exist, the remote is unreachable, or the branch does not exist on the remote.","commonSituations":"Remote added via `bd dolt remote add` but never fetched; typo in remote name or branch; network outage or auth failure against the Dolt remote; remote deleted or renamed.","solutions":["Run `bd dolt fetch <remote>` manually to reproduce and see the underlying fetch error","Verify the remote exists: `bd dolt remote -v` (name must match what was passed)","Check network/auth connectivity to the remote URL","Confirm the branch exists on the remote; create or push it if missing"],"exampleFix":"// before\nbd dolt pull  // fails with fetch from origin/be-b0am\n// after\nbd dolt remote -v            // confirm remote name is 'origin'\nbd dolt fetch origin         // surface the real network/auth error\nbd dolt pull                 // retry","handlingStrategy":"validation","validationCode":"// Validate the remote and branch exist before pulling\nremotes, err := store.ListRemotes(ctx)\nif err != nil || !slices.Contains(remotes, remote) {\n    return fmt.Errorf(\"remote %q not configured\", remote)\n}","typeGuard":null,"tryCatchPattern":"if err := store.Pull(ctx); err != nil {\n    if strings.HasPrefix(err.Error(), \"fetch from \") {\n        // surface remote/branch from the message and re-check config:\n        // bd dolt remote -v; bd dolt fetch <remote>\n        return fmt.Errorf(\"pull failed at fetch; verify remote config: %w\", err)\n    }\n    return err\n}","preventionTips":["Add remotes via bd bootstrap/dolt clone so tracking config is written","Run bd dolt fetch after adding a remote to validate connectivity early","Verify remote names and branch names against bd dolt remote -v"],"tags":["dolt","git","fetch","network"],"backgroundTag":"dolt-fetch-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}