{"record":{"id":"1878d6629fa9cdd0","repo":"gastownhall/beads","slug":"list-dolt-remotes-before-git-protocol-routing-for","errorCode":null,"errorMessage":"list Dolt remotes before git-protocol routing for peer %q: %w","messagePattern":"list Dolt remotes before git-protocol routing for peer %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/federation.go","lineNumber":632,"sourceCode":"\t\t\"federation: exclude private issue types\"); err != nil {\n\t\treturn fmt.Errorf(\"federation filter: commit filtered state: %w\", err)\n\t}\n\treturn nil\n}\n\n// prepareCLIRouteForPeerGitProtocol reports whether the SQL-visible peer\n// remote uses git wire protocol and prepares the matching local CLI remote\n// before routing.\nfunc (s *DoltStore) prepareCLIRouteForPeerGitProtocol(ctx context.Context, peer string) (bool, error) {\n\tif s.CLIDir() == \"\" {\n\t\treturn false, nil\n\t}\n\tif !s.hasCLIDatabase() {\n\t\treturn false, nil\n\t}\n\tremotes, err := s.ListRemotes(ctx)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"list Dolt remotes before git-protocol routing for peer %q: %w\", peer, err)\n\t}\n\tfor _, r := range remotes {\n\t\tif r.Name == peer {\n\t\t\tif !doltutil.IsGitProtocolURL(r.URL) {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tif err := s.ensureMatchingCLIRemote(peer, r.URL); err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"peer remote %q uses git protocol and requires CLI routing: %w\", peer, err)\n\t\t\t}\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}\n\nfunc (s *DoltStore) shouldUseCLIForPeerGitProtocol(ctx context.Context, peer string) (bool, error) {\n\treturn s.prepareCLIRouteForPeerGitProtocol(ctx, peer)\n}","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/federation.go#L614-L650","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the dolt CLI binary is installed and on PATH at the expected version","Check the CLI database directory exists and is readable/writable by the process","Run `dolt remote -v` manually in the CLI database directory to reproduce the underlying error","Inspect the wrapped ListRemotes error (CLI stderr) for the concrete cause"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// preflight before federation ops\nif _, err := exec.LookPath(\"dolt\"); err != nil {\n\treturn fmt.Errorf(\"dolt CLI not on PATH: %w\", err)\n}\nif err := dolt.ValidateDatabaseName(dbName); err != nil { return err }","typeGuard":null,"tryCatchPattern":"useCLI, err := prepareCLIRouteForPeerGitProtocol(ctx, peer)\nif err != nil {\n\tlog.Printf(\"CLI routing undetermined for %s: %v; using SQL path\", peer, err)\n\tuseCLI = false\n}","preventionTips":["Install the dolt CLI and verify with `dolt version` in CI","Ensure CLI database dir is writable by the service user","Preflight `dolt remote -v` at startup"],"tags":["dolt","cli","remotes","federation","routing"],"backgroundTag":"dolt-cli-list-remotes-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}