{"record":{"id":"6e394cd4e6fd964c","repo":"gastownhall/beads","slug":"invalid-remote-url-w-6e394c","errorCode":null,"errorMessage":"invalid remote URL: %w","messagePattern":"invalid remote URL: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/bootstrap.go","lineNumber":55,"sourceCode":"\n// BootstrapFromGitRemote is deprecated. Use BootstrapFromRemote instead.\nfunc BootstrapFromGitRemote(ctx context.Context, doltDir, gitRemoteURL string) (bool, error) {\n\treturn BootstrapFromRemote(ctx, doltDir, gitRemoteURL)\n}\n\n// BootstrapFromRemoteWithDB is like BootstrapFromRemote but allows\n// specifying the database name (used by the embedded driver for the\n// subdirectory structure). The database parameter must not be empty;\n// callers should use cfg.GetDoltDatabase() which applies the fallback chain\n// (env var → config → default).\nfunc BootstrapFromRemoteWithDB(ctx context.Context, doltDir, remoteURL, database string) (bool, error) {\n\t// Skip if Dolt database already exists\n\tif doltExists(doltDir) {\n\t\treturn false, nil\n\t}\n\n\tif err := remotecache.ValidateRemoteURL(remoteURL); err != nil {\n\t\treturn false, fmt.Errorf(\"invalid remote URL: %w\", err)\n\t}\n\n\tif err := ValidateDatabaseName(database); err != nil {\n\t\treturn false, fmt.Errorf(\"invalid database name %q (use cfg.GetDoltDatabase() to resolve the configured name): %w\", database, err)\n\t}\n\n\t// Verify dolt CLI is available\n\tif _, err := exec.LookPath(\"dolt\"); err != nil {\n\t\treturn false, fmt.Errorf(\"dolt CLI not found (required for remote bootstrap): %w\", err)\n\t}\n\n\t// Create the parent dolt directory\n\tif err := os.MkdirAll(doltDir, 0o750); err != nil {\n\t\treturn false, fmt.Errorf(\"failed to create dolt directory: %w\", err)\n\t}\n\n\t// Clone into <doltDir>/<database>/ so the embedded driver can find it.\n\t// `dolt clone <url> <target>` creates <target>/.dolt/ directly.","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/bootstrap.go#L37-L73","documentation":"BootstrapFromRemoteWithDB clones a Dolt database from a configured sync.remote URL when no local .beads/dolt/ exists. Before cloning, it validates the URL with remotecache.ValidateRemoteURL and wraps any failure as \"invalid remote URL\". This means the configured remote is malformed or uses an unsupported scheme, so bootstrap refuses to shell out to `dolt clone`.","triggerScenarios":"Calling BootstrapFromRemote/BootstrapFromRemoteWithDB (or `bd bootstrap`) when config.yaml sync.remote (or the remoteURL argument) is empty, malformed, or uses a scheme rejected by ValidateRemoteURL.","commonSituations":"Typos in the remote URL in .beads/config.yaml; a file:// or relative path pasted where a git/DoltHub/S3/GCS URL is expected; an env-var-substituted remote that resolved to an empty string; hand-edited config with stray whitespace or quotes.","solutions":["Print and inspect the URL: `bd config get sync.remote` or read .beads/config.yaml, then fix the value to a valid remote URL (git https/ssh, DoltHub, S3, GCS, or file URL accepted by ValidateRemoteURL).","If the value came from an environment variable, verify it is actually set and has no surrounding quotes/whitespace: `echo \"$BEADS_REMOTE\"`.","Run `bd doctor` or call remotecache.ValidateRemoteURL in a scratch program to see the precise validation failure and the accepted URL formats.","If you intend no remote, remove the sync.remote key entirely so bootstrap does not attempt a clone."],"exampleFix":"# before (.beads/config.yaml)\nsync:\n  remote: my-remote-url\n# after\nsync:\n  remote: https://doltremoteapi.dolthub.com/org/beads","handlingStrategy":"validation","validationCode":"if err := remotecache.ValidateRemoteURL(remoteURL); err != nil {\n    return fmt.Errorf(\"fix sync.remote before bootstrapping: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"ok, err := dolt.BootstrapFromRemote(ctx, doltDir, remote)\nif err != nil && strings.Contains(err.Error(), \"invalid remote URL\") {\n    // surface config guidance: check sync.remote in .beads/config.yaml\n    return fmt.Errorf(\"check `bd config get sync.remote`: %w\", err)\n}","preventionTips":["Always set sync.remote through `bd config` or a validated template, never by hand-editing YAML.","Call cfg.GetDoltDatabase()/config accessors instead of reading raw env/config values for remote URLs.","Run `bd doctor` after cloning or editing config to catch malformed remotes before bootstrap."],"tags":["configuration","dolt","url-validation","bootstrap"],"backgroundTag":"invalid-remote-url","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}