{"record":{"id":"ecac4260e8e5d29b","repo":"gastownhall/beads","slug":"list-dolt-remotes-before-credential-routing-for-re","errorCode":null,"errorMessage":"list Dolt remotes before credential routing for remote %q: %w","messagePattern":"list Dolt remotes before credential routing for remote %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/credentials.go","lineNumber":693,"sourceCode":"\t\tlog.Printf(\"warning: %v\", err)\n\t\treturn false\n\t}\n\treturn ok\n}\n\nfunc (s *DoltStore) prepareCLIRouteForCredentials(ctx context.Context, remote string, creds *remoteCredentials) (bool, error) {\n\tif creds.empty() {\n\t\treturn false, nil // no credentials to pass\n\t}\n\tif !s.serverMode {\n\t\treturn false, nil // embedded mode: withEnvCredentials works in-process\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 credential routing for remote %q: %w\", remote, err)\n\t}\n\tfor _, r := range remotes {\n\t\tif r.Name == remote {\n\t\t\tif err := s.ensureMatchingCLIRemote(remote, r.URL); err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"remote %q has credentials and requires CLI routing: %w\", remote, 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) shouldUseCLIForCredentialsWithError(ctx context.Context, remote string, creds *remoteCredentials) (bool, error) {\n\treturn s.prepareCLIRouteForCredentials(ctx, remote, creds)\n}\n\nfunc (s *DoltStore) shouldUseCLIForLocalRemoteWithError(ctx context.Context, remote string) (bool, error) {\n\tif !s.serverMode {","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/credentials.go#L675-L711","documentation":"prepareCLIRouteForCredentials lists SQL-visible Dolt remotes to decide whether a credential-bearing push/pull must go through the CLI subprocess instead of CALL DOLT_PUSH/PULL. This error wraps a ListRemotes failure during that pre-flight for a remote. Without the remote list, bd cannot safely route credentials, so it returns the wrapped error (or logs a warning and falls back to the SQL path via shouldUseCLIForCredentials).","triggerScenarios":"ListRemotes fails because the dolt-sql-server is down or the connection dropped, the context is cancelled, or the query errors (locks, missing dolt database in the server). Reached only when creds are non-empty and the store is in server mode with a CLI database.","commonSituations":"Pushing to an authenticated remote right after the external SQL server was restarted; transient network issues with a remote dolt-sql-server; stale client connections in a long-lived process.","solutions":["Verify dolt-sql-server is running and reachable; restart it and reopen the store if needed.","Retry the push/pull — transient connection errors often clear.","Check the Dolt server logs for the underlying ListRemotes failure and fix the root cause.","As a workaround, run in embedded mode where credential routing doesn't need this pre-flight."],"exampleFix":"// before: server down\npushToRemote(...) // list Dolt remotes before credential routing for remote \"origin\": connection refused\n// after\n# systemctl restart dolt-sql-server\npushToRemote(...)","handlingStrategy":"retry","validationCode":"// verify the SQL server answers before push/pull routing\nif err := db.PingContext(ctx); err != nil { /* reconnect or restart server */ }","typeGuard":null,"tryCatchPattern":"if err := pushToRemote(ctx, remote); err != nil && strings.Contains(err.Error(), \"list Dolt remotes before credential routing\") {\n    // transient server issue — reconnect and retry once\n    store.Reconnect(ctx)\n    err = pushToRemote(ctx, remote)\n}","preventionTips":["Restart the SQL server and reopen stores after server maintenance","Add retry-with-backoff around push/pull in automation","Watch server logs for recurring ListRemotes failures","Prefer embedded mode when external-server flakiness blocks syncs"],"tags":["database","remotes","cli-routing","server-mode"],"backgroundTag":"list-remotes-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}