{"record":{"id":"1d774dae86d99a78","repo":"benbjohnson/litestream","slug":"must-specify-at-least-one-replica-url-for-s","errorCode":null,"errorMessage":"must specify at least one replica URL for %s","messagePattern":"must specify at least one replica URL for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/replicate.go","lineNumber":104,"sourceCode":"\t\t}\n\t\tif c.Config, err = ReadConfigFile(*configPath, !*noExpandEnv); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Override log level if CLI flag provided (takes precedence over env var)\n\t\tif *logLevelFlag != \"\" {\n\t\t\tc.Config.Logging.Level = *logLevelFlag\n\t\t\t// Set env var so initLog sees CLI flag as highest priority\n\t\t\tos.Setenv(\"LOG_LEVEL\", *logLevelFlag)\n\t\t\tlogOutput := os.Stdout\n\t\t\tif c.Config.Logging.Stderr {\n\t\t\t\tlogOutput = os.Stderr\n\t\t\t}\n\t\t\tinternal.InitLog(logOutput, c.Config.Logging.Level, c.Config.Logging.Type, c.Config.Logging.Source)\n\t\t}\n\n\tcase 1:\n\t\t// Only database path provided, missing replica URL\n\t\treturn fmt.Errorf(\"must specify at least one replica URL for %s\", fs.Arg(0))\n\n\tdefault:\n\t\t// Database path and replica URLs provided via CLI\n\t\tif *configPath != \"\" {\n\t\t\treturn fmt.Errorf(\"cannot specify a replica URL and the -config flag\")\n\t\t}\n\n\t\t// Initialize config with defaults when using command-line arguments\n\t\tc.Config = DefaultConfig()\n\t\tlogLevel := \"INFO\"\n\t\tif *logLevelFlag != \"\" {\n\t\t\tlogLevel = *logLevelFlag\n\t\t\t// Set env var so initLog sees CLI flag as highest priority\n\t\t\tos.Setenv(\"LOG_LEVEL\", *logLevelFlag)\n\t\t}\n\t\tc.Config.Logging.Level = logLevel\n\t\tinternal.InitLog(os.Stdout, logLevel, \"text\", false)\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/replicate.go#L86-L122","documentation":"`litestream replicate` accepts a config file OR explicit CLI arguments, not a bare database path alone. If exactly one positional argument is given (a DB path with no replica URL), ParseFlags rejects it because replication needs at least one replica destination.","triggerScenarios":"Running `litestream replicate /path/to/db` with one positional arg and no -config; intending to supply replicas via config but forgetting the -config flag; shell quoting dropping the second argument.","commonSituations":"Users migrating from config-file usage who pass just the DB path; scripts where the replica URL variable is empty so only the DB path remains as an argument; quoting mistakes swallowing the URL.","solutions":["Add the replica URL: `litestream replicate /path/to/db s3://bucket/prefix`","Or point to a config: `litestream replicate -config /etc/litestream.yml`","Echo the command in your script to verify the replica argument isn't empty or lost to quoting"],"exampleFix":"// before\nlitestream replicate /var/lib/app/db.sqlite\n// after\nlitestream replicate /var/lib/app/db.sqlite s3://mybucket/litestream","handlingStrategy":"validation","validationCode":"[ -n \"$REPLICA_URL\" ] || { echo \"replica URL required: litestream replicate $DB s3://bucket/prefix\"; exit 1; }\nlitestream replicate \"$DB\" \"$REPLICA_URL\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a replica URL after the DB path, or use -config","Quote variables so an empty REPLICA doesn't silently drop the argument","Add a shell guard for empty replica variables in scripts"],"tags":["cli","arguments","replication"],"backgroundTag":"missing-cli-argument","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}