gastownhall/beads · error

fetch from %s/%s: %w

Error message

fetch from %s/%s: %w

What it means

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.

Source

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

		return pullReport{}, fmt.Errorf("failed to set dolt_force_transaction_commit: %w", err)
	}

	// DOLT_PULL's row is the engine's only in-band account of what the pull
	// did: `dolt pull` on the CLI exits 0 whether it merged or was already up
	// to date, and so does this CALL. Capturing it costs nothing — the drain
	// is identical — and it is the difference between a caller that knows
	// nothing arrived and one that only knows no error occurred (ga-bq9zd).
	pullRow, pullErr := schema.CallReturningRow(ctx, tx, query, args...)
	report := parseMergeReport(pullRow)

	// GH#3144: When DOLT_PULL fails because upstream branch tracking is not
	// configured in repo_state.json (common when remote was added via
	// bd dolt remote add rather than bd bootstrap/dolt clone), fall back to
	// DOLT_FETCH + DOLT_MERGE which does not require tracking config.
	if pullErr != nil && isBranchTrackingError(pullErr) {
		if err := schema.DrainCall(ctx, tx, "CALL DOLT_FETCH(?, ?)", remote, s.branch); err != nil {
			_ = tx.Rollback()
			return pullReport{}, fmt.Errorf("fetch from %s/%s: %w", remote, s.branch, err)
		}
		trackingRef := remote + "/" + s.branch
		// The merge, not the pull, is now what happened — so its row replaces
		// the failed pull's report rather than adding to it.
		mergeRow, mergeErr := schema.CallReturningRow(ctx, tx, "CALL DOLT_MERGE(?)", trackingRef)
		report = parseMergeReport(mergeRow)
		// Retained deliberately even though DOLT_MERGE reports the ordinary
		// no-op as a MESSAGE with a nil error (measured: "Everything
		// up-to-date" and "cannot fast forward from a to b. a is ahead of b
		// already" both arrive that way). Dolt's squash path still returns
		// "Already up to date." as a real error, and that is what this catches.
		if mergeErr != nil && strings.Contains(mergeErr.Error(), "up to date") {
			mergeErr = nil
		}
		pullErr = mergeErr
	}

	return report, s.settleMergeInTx(ctx, tx, pullErr)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd dolt fetch <remote>` manually to reproduce and see the underlying fetch error
  2. Verify the remote exists: `bd dolt remote -v` (name must match what was passed)
  3. Check network/auth connectivity to the remote URL
  4. Confirm the branch exists on the remote; create or push it if missing

Example fix

// before
bd dolt pull  // fails with fetch from origin/be-b0am
// after
bd dolt remote -v            // confirm remote name is 'origin'
bd dolt fetch origin         // surface the real network/auth error
bd dolt pull                 // retry
Defensive patterns

Strategy: validation

Validate before calling

// Validate the remote and branch exist before pulling
remotes, err := store.ListRemotes(ctx)
if err != nil || !slices.Contains(remotes, remote) {
    return fmt.Errorf("remote %q not configured", remote)
}

Try / catch

if err := store.Pull(ctx); err != nil {
    if strings.HasPrefix(err.Error(), "fetch from ") {
        // surface remote/branch from the message and re-check config:
        // bd dolt remote -v; bd dolt fetch <remote>
        return fmt.Errorf("pull failed at fetch; verify remote config: %w", err)
    }
    return err
}

Prevention

When it happens

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

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

Related errors


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