{"record":{"id":"49b74c05fb1ac135","repo":"gastownhall/beads","slug":"list-remotes-w","errorCode":null,"errorMessage":"list remotes: %w","messagePattern":"list remotes: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/init_proxied_server.go","lineNumber":395,"sourceCode":"\t\t\t}\n\t\t}\n\t\tif err := cfg.SetMetadata(ctx, \"last_import_time\", time.Now().UTC().Format(time.RFC3339)); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"record last_import_time: %w\", err)\n\t\t}\n\t\tif err := cfg.SetLocalMetadata(ctx, workapi.MetadataKeyVersion, Version); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"record bd_version: %w\", err)\n\t\t}\n\t\treturn \"bd init\", nil\n\t})\n}\n\n// configureProxiedInitDoltRemote adds the sync remote, skipping a name that is\n// already taken.\nfunc configureProxiedInitDoltRemote(ctx context.Context, provider uow.UnitOfWorkProvider, remoteURL string) error {\n\treturn uow.RunTx(ctx, provider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) {\n\t\tremotes, err := uw.DoltRemoteUseCase().ListRemotes(ctx)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"list remotes: %w\", err)\n\t\t}\n\t\tfor _, r := range remotes {\n\t\t\tif r.Name == \"origin\" {\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t}\n\t\tif err := uw.DoltRemoteUseCase().CreateRemote(ctx, \"origin\", remoteURL); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"create remote origin: %w\", err)\n\t\t}\n\t\treturn \"\", nil\n\t})\n}\n\n// adoptTeamServerIdentity reads the bts-provisioned identity out of the shared\n// database, following the gateway contract: adopt if present, hard error if\n// absent — bd never writes identity in team-server mode.\n//\n// ABSENT means \"unprovisioned, tell them to run bts init\" and UNREADABLE means","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/init_proxied_server.go#L377-L413","documentation":"In configureProxiedInitDoltRemote, bd lists existing Dolt remotes before creating 'origin'. This wrapper fires when DoltRemoteUseCase().ListRemotes fails, aborting remote setup during proxied-server init. The wrapped error (driver/connection/storage) carries the real cause.","triggerScenarios":"bd init in team-server mode where enumerating remotes from the shared Dolt database fails — server unreachable, database missing, or query error on the remotes table.","commonSituations":"Wrong database name in config pointing at a nonexistent Dolt database; proxied server not yet started when init runs; network partition to the team server.","solutions":["Verify the proxied Dolt server is running and reachable, then retry bd init","Confirm the configured Dolt database name exists (bts init provisions it)","Check bd doctor output and the wrapped driver error for specifics","If the database was healed with 'bts migrate', re-run bd init afterwards"],"exampleFix":"// before\nerr: \"list remotes: database dolt_team not found\"\n// after: provision the shared db first, then init\nbts init   # creates and provisions the database\nbd init","handlingStrategy":"try-catch","validationCode":"// pre-check: the shared database exists and server responds\nif err := pingDoltServer(serverAddr, dbName); err != nil {\n    return fmt.Errorf(\"provision db with bts init first: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"list remotes:\") {\n    log.Printf(\"remote enumeration failed: %v\", errors.Unwrap(err))\n    // verify server up + db name correct, then retry init\n}","preventionTips":["Provision the database with 'bts init' before pointing bd at it","Confirm the Dolt database name in config matches a real database","Check server availability with bd doctor before init","Retry on transient network errors"],"tags":["init","dolt","remote","team-server","git-remote"],"backgroundTag":"dolt-remote-list-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}