gastownhall/beads · error

failed to pull from %s/%s: %w

Error message

failed to pull from %s/%s: %w

What it means

Wraps a failure from the authenticated SQL pull route: CALL DOLT_PULL executed over a long-timeout connection with the '--user' argument (remoteUser set, pulling from the store's default remote), inside the remote's credential/S3 environment. The wrapped cause is the DOLT_PULL (or conflict auto-resolution) failure itself.

Source

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

	} else if useCLI {
		return pullReport{}, s.finishCLIPull(ctx, s.doltCLIPull(ctx, remote, creds))
	}
	// Cloud auth CLI routing (GH#6), including post-pull auto-resolution.
	if useCLI, err := s.prepareCLIRouteForCloudAuth(ctx, remote); err != nil {
		return pullReport{}, err
	} else if useCLI {
		return pullReport{}, s.finishCLIPull(ctx, s.doltCLIPull(ctx, remote, creds))
	}
	// Local file:// pulls intentionally stay on the SQL path. The matching CLI
	// guard is a push-only optimization; SQL pull keeps pullWithAutoResolve in
	// charge of metadata-only conflict repair.
	var report pullReport
	if s.remoteUser != "" && remote == s.remote {
		err := withRemoteOperationEnv(creds, s.isS3Remote(ctx, remote), func() error {
			var err error
			report, err = s.pullWithAutoResolveReporting(ctx, remote, "CALL DOLT_PULL('--user', ?, ?, ?)", s.remoteUser, remote, s.branch)
			if err != nil {
				return fmt.Errorf("failed to pull from %s/%s: %w", remote, s.branch, err)
			}
			return nil
		})
		return report, err
	}
	err := withRemoteOperationEnv(nil, s.isS3Remote(ctx, remote), func() error {
		var err error
		report, err = s.pullWithAutoResolveReporting(ctx, remote, "CALL DOLT_PULL(?, ?)", remote, s.branch)
		if err != nil {
			return fmt.Errorf("failed to pull from %s/%s: %w", remote, s.branch, err)
		}
		return nil
	})
	return report, err
}

// pullWithAutoResolve executes a DOLT_PULL query with long timeout and auto-resolves
// metadata-only merge conflicts using "theirs" strategy. This handles the common case

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped cause: auth errors → refresh credentials; timeouts → check network to the remote host.
  2. Verify the remote exists: SELECT * FROM dolt_remotes; and re-add with CALL DOLT_REMOTE('add', ...) if missing.
  3. Confirm remoteUser/password are current (dolt sql -q "select 1" against the hosted remote).
  4. If conflicts are the cause, resolve them manually or run the conflict repair path, then re-pull.
  5. Check S3/cloud credentials in the environment when the remote is S3-backed.

Example fix

// before
err := store.Pull(ctx) // fails: auth rejected for --user
// after
// refresh creds first:
// CALL DOLT_REMOTE('add', 'origin', 'https://user:newtoken@doltremoteapi.dolthub.com/org/bd', '--force')
err := store.Pull(ctx)
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check remote and creds:
// SELECT name, url FROM dolt_remotes WHERE name = ?;
// probe: db.QueryRow("SELECT 1") against the hosted remote endpoint

Try / catch

if err := store.Pull(ctx); err != nil {
    if strings.Contains(err.Error(), fmt.Sprintf("failed to pull from %s/%s", remote, branch)) {
        log.Printf("pull failed, cause: %v", errors.Unwrap(errors.Unwrap(err)))
        // route by cause: auth → refresh creds; conflict → repair; timeout → retry
    }
    return err
}

Prevention

When it happens

Trigger: Pull()/PullRemote() taking the SQL path where s.remoteUser != "" and remote == s.remote, and the DOLT_PULL stored procedure errors: auth rejection, network timeout, merge conflict not auto-resolvable, unknown remote, or branch does not exist on the remote.

Common situations: Expired or wrong Dolt remote credentials (remoteUser/password); remote not registered in this database; sql-server cannot reach doltremoteapi/S3; merge conflicts involving non-metadata rows; the remote branch was renamed or deleted.

Related errors


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