gastownhall/beads · error

list Dolt remotes before git-protocol routing for peer %q: %

Error message

list Dolt remotes before git-protocol routing for peer %q: %w

What it means

Wraps a failure from s.ListRemotes during prepareCLIRouteForPeerGitProtocol. Before deciding whether a peer remote needs the Dolt CLI (git-protocol URLs aren't supported by the Go SQL path), the store lists configured Dolt remotes; if that listing fails, routing cannot be determined. The function returns (false, err), so callers fall back to non-CLI behavior while surfacing this error.

Source

Thrown at internal/storage/dolt/federation.go:632

		"federation: exclude private issue types"); err != nil {
		return fmt.Errorf("federation filter: commit filtered state: %w", err)
	}
	return nil
}

// prepareCLIRouteForPeerGitProtocol reports whether the SQL-visible peer
// remote uses git wire protocol and prepares the matching local CLI remote
// before routing.
func (s *DoltStore) prepareCLIRouteForPeerGitProtocol(ctx context.Context, peer string) (bool, error) {
	if s.CLIDir() == "" {
		return false, nil
	}
	if !s.hasCLIDatabase() {
		return false, nil
	}
	remotes, err := s.ListRemotes(ctx)
	if err != nil {
		return false, fmt.Errorf("list Dolt remotes before git-protocol routing for peer %q: %w", peer, err)
	}
	for _, r := range remotes {
		if r.Name == peer {
			if !doltutil.IsGitProtocolURL(r.URL) {
				return false, nil
			}
			if err := s.ensureMatchingCLIRemote(peer, r.URL); err != nil {
				return false, fmt.Errorf("peer remote %q uses git protocol and requires CLI routing: %w", peer, err)
			}
			return true, nil
		}
	}
	return false, nil
}

func (s *DoltStore) shouldUseCLIForPeerGitProtocol(ctx context.Context, peer string) (bool, error) {
	return s.prepareCLIRouteForPeerGitProtocol(ctx, peer)
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify the dolt CLI binary is installed and on PATH at the expected version
  2. Check the CLI database directory exists and is readable/writable by the process
  3. Run `dolt remote -v` manually in the CLI database directory to reproduce the underlying error
  4. Inspect the wrapped ListRemotes error (CLI stderr) for the concrete cause
Defensive patterns

Strategy: fallback

Validate before calling

// preflight before federation ops
if _, err := exec.LookPath("dolt"); err != nil {
	return fmt.Errorf("dolt CLI not on PATH: %w", err)
}
if err := dolt.ValidateDatabaseName(dbName); err != nil { return err }

Try / catch

useCLI, err := prepareCLIRouteForPeerGitProtocol(ctx, peer)
if err != nil {
	log.Printf("CLI routing undetermined for %s: %v; using SQL path", peer, err)
	useCLI = false
}

Prevention

When it happens

Trigger: pushRefToPeer, pullFromPeer, Fetch, or shouldUseCLIForPeerGitProtocol call prepareCLIRouteForPeerGitProtocol on a store with a CLI database, and ListRemotes fails (dolt CLI invocation error, missing/ broken CLI binary, CLI database not initialized, context canceled).

Common situations: dolt binary not installed or wrong PATH; CLI database directory corrupted or permissions-denied; running inside a container without the CLI; timeout on the dolt remote -v subprocess.

Related errors


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