{"record":{"id":"c260f82136211256","repo":"gastownhall/beads","slug":"clone-from-remote-via-server-w","errorCode":null,"errorMessage":"clone from remote via server: %w","messagePattern":"clone from remote via server: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/bootstrap.go","lineNumber":974,"sourceCode":"\t\t// No Database — DOLT_CLONE creates the database.\n\t}.String()\n\n\tdb, err := sql.Open(\"mysql\", dsn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"connect to dolt server for clone: %w\", err)\n\t}\n\tdefer db.Close()\n\n\tcloneCtx, cancel := context.WithTimeout(ctx, 5*time.Minute)\n\tdefer cancel()\n\n\tif err := db.PingContext(cloneCtx); err != nil {\n\t\treturn fmt.Errorf(\"dolt server unreachable at %s:%d (is dolt sql-server running?): %w\",\n\t\t\tcfg.GetDoltServerHost(), port, err)\n\t}\n\n\tif err := versioncontrolops.DoltClone(cloneCtx, db, remoteURL, dbName, os.Getenv(\"DOLT_REMOTE_USER\")); err != nil {\n\t\treturn fmt.Errorf(\"clone from remote via server: %w\", err)\n\t}\n\tfmt.Fprintf(os.Stderr, \"Synced database from %s (via server at %s:%d)\\n\",\n\t\tremoteURL, cfg.GetDoltServerHost(), port)\n\treturn nil\n}\n\nfunc serverClonePort(beadsDir string, cfg *configfile.Config) int {\n\tif cfg != nil && cfg.DoltServerPort > 0 {\n\t\treturn cfg.DoltServerPort\n\t}\n\tif p := os.Getenv(\"BEADS_DOLT_SERVER_PORT\"); p != \"\" {\n\t\tif port, err := strconv.Atoi(p); err == nil && port > 0 {\n\t\t\treturn port\n\t\t}\n\t}\n\tif p := os.Getenv(\"BEADS_DOLT_PORT\"); p != \"\" {\n\t\tif port, err := strconv.Atoi(p); err == nil && port > 0 {\n\t\t\treturn port","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/bootstrap.go#L956-L992","documentation":"Wrapped by cloneViaServer in cmd/bd/bootstrap.go:974 when versioncontrolops.DoltClone fails while executing CALL DOLT_CLONE through the connected external Dolt server. The connection succeeded; the clone itself failed on the server side — typically the server cannot reach the remote, lacks credentials, or the database already exists on the server.","triggerScenarios":"DoltClone issues DOLT_CLONE over the MySQL connection and the server returns an error: server has no outbound network access to the remote URL, remote auth fails server-side, dbName already exists on the server (clone refuses to overwrite), or timeout for very large databases.","commonSituations":"Air-gapped/egress-restricted server host; database with the same name already cloned by a teammate on the shared server; expired Dolt credentials on the server machine; large repo exceeding the 5-minute cloneCtx timeout.","solutions":["Check the server host can reach the remote URL (curl/dolt clone from the server machine)","Drop the already-existing database on the server (`DROP DATABASE <dbName>`) if it is safe to re-clone, or use a different dbName","Configure/refresh Dolt credentials on the server machine for the remote account","For large databases, increase the timeout or pre-clone via the CLI path (owned-server mode)"],"exampleFix":"// before: db already exists on shared server\n$ bd bootstrap\n// error: clone from remote via server: database beads already exists\n// after\n$ dolt -r ~/beads-server sql -q 'DROP DATABASE beads'\n$ bd bootstrap","handlingStrategy":"try-catch","validationCode":"// server needs outbound access to the remote and a free database name\n// pre-check from the server machine:\ncurl -sI https://doltremoteapi.dolthub.com/org/beads | head -1\n// ensure dbName does not already exist on the server:\ndolt sql -q \"SHOW DATABASES LIKE 'beads'\"","typeGuard":null,"tryCatchPattern":"err := cloneViaServer(ctx, dir, url, db, cfg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"clone from remote via server\") {\n\t\t// inspect server-side cause: egress, credentials, or existing database\n\t\t// optionally DROP DATABASE and retry\n\t}\n}","preventionTips":["Ensure the server host has outbound network access to the Dolt remote API","Keep Dolt remote credentials fresh on the machine running the server","Check for an existing database with the same name on shared servers before cloning","Plan for the 5-minute clone timeout on very large databases; pre-seed via CLI if needed"],"tags":["dolt-clone","dolt-server","remote-sync"],"backgroundTag":"dolt-remote-clone-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}