{"record":{"id":"050b8722b240ff98","repo":"gastownhall/beads","slug":"connect-to-dolt-server-for-clone-w","errorCode":null,"errorMessage":"connect to dolt server for clone: %w","messagePattern":"connect to dolt server for clone: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/bootstrap.go","lineNumber":961,"sourceCode":"// cloneViaServer clones by connecting to the external Dolt server and\n// executing CALL DOLT_CLONE. The server places the database in its own\n// data directory, which is the correct behavior for externally managed\n// servers where bd does not know the filesystem layout.\nfunc cloneViaServer(ctx context.Context, beadsDir, remoteURL, dbName string, cfg *configfile.Config) error {\n\tport := serverClonePort(beadsDir, cfg)\n\tdsn := doltutil.ServerDSN{\n\t\tSocket:   cfg.GetDoltServerSocket(),\n\t\tHost:     cfg.GetDoltServerHost(),\n\t\tPort:     port,\n\t\tUser:     cfg.GetDoltServerUser(),\n\t\tPassword: cfg.GetDoltServerPasswordForPort(port),\n\t\tTLS:      cfg.GetDoltServerTLS(),\n\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}","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/bootstrap.go#L943-L979","documentation":"Wrapped by cloneViaServer in cmd/bd/bootstrap.go:961 when sql.Open(\"mysql\", dsn) fails to construct a connection to the external Dolt sql-server using the configured DSN (socket/host/port/user/password/TLS). sql.Open only validates the DSN format and driver availability, so this usually means a malformed DSN configuration value.","triggerScenarios":"cloneFromRemoteWithMode resolves external-server mode and calls cloneViaServer; sql.Open errors on an invalid DSN — e.g., malformed socket path, invalid characters in host/user/password from metadata.json, or bad TLS setting string.","commonSituations":"Typos in dolt_server.host/socket fields in .beads/metadata.json; special characters (like @ or /) in a password not escaped correctly; empty/invalid TLS config value.","solutions":["Inspect dolt_server fields in .beads/metadata.json and fix host/port/socket/user values","If the password contains special characters, quote/escape it or reset it to a URL-safe value","Verify TLS setting is a valid value per doltutil.ServerDSN","Re-run bd bootstrap after correcting config"],"exampleFix":"// before: metadata.json has dolt_server.socket: \"/tmp/my server.sock\" (space breaks DSN)\n// after: move server socket to a clean path\n$ bd update-config  # or edit metadata.json: \"socket\": \"/tmp/beads-dolt.sock\"\n$ bd bootstrap","handlingStrategy":"validation","validationCode":"// validate server config before clone\ncfg, _ := configfile.Load(beadsDir)\nif cfg.GetDoltServerSocket() == \"\" && cfg.GetDoltServerHost() == \"\" {\n\treturn errors.New(\"neither socket nor host configured for dolt server\")\n}\nif cfg.GetDoltServerSocket() != \"\" {\n\tif _, err := os.Stat(cfg.GetDoltServerSocket()); err != nil {\n\t\treturn fmt.Errorf(\"socket path invalid: %w\", err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"err := cloneViaServer(ctx, dir, url, db, cfg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"connect to dolt server for clone\") {\n\t\t// DSN malformed: inspect dolt_server fields in metadata.json\n\t}\n}","preventionTips":["Keep passwords URL-safe or escape special characters in server credentials","Validate dolt_server host/port/socket values in metadata.json after editing","Use numeric port values and standard hostnames; avoid spaces in socket paths","Test the DSN with a mysql client before running bd bootstrap"],"tags":["mysql-dsn","config","dolt-server"],"backgroundTag":"invalid-dsn-config","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}