{"record":{"id":"638268586e2a2ab6","repo":"benbjohnson/litestream","slug":"replica-url-or-config-file-required","errorCode":null,"errorMessage":"replica URL or config file required","messagePattern":"replica URL or config file required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream-test/validate.go","lineNumber":56,"sourceCode":"func (c *ValidateCommand) Run(ctx context.Context, args []string) error {\n\tfs := flag.NewFlagSet(\"litestream-test validate\", flag.ExitOnError)\n\tfs.StringVar(&c.SourceDB, \"source-db\", \"\", \"Original database path\")\n\tfs.StringVar(&c.ReplicaURL, \"replica-url\", \"\", \"Replica URL to validate\")\n\tfs.StringVar(&c.RestoredDB, \"restored-db\", \"\", \"Path for restored database\")\n\tfs.StringVar(&c.CheckType, \"check-type\", \"quick\", \"Type of check (quick, integrity, checksum, full)\")\n\tfs.BoolVar(&c.LTXContinuity, \"ltx-continuity\", false, \"Check LTX file continuity\")\n\tfs.StringVar(&c.ConfigPath, \"config\", \"\", \"Litestream config file path\")\n\tfs.Usage = c.Usage\n\tif err := fs.Parse(args); err != nil {\n\t\treturn err\n\t}\n\n\tif c.SourceDB == \"\" {\n\t\treturn fmt.Errorf(\"source database path required\")\n\t}\n\n\tif c.ReplicaURL == \"\" && c.ConfigPath == \"\" {\n\t\treturn fmt.Errorf(\"replica URL or config file required\")\n\t}\n\n\tif c.RestoredDB == \"\" {\n\t\tc.RestoredDB = c.SourceDB + \".restored\"\n\t}\n\n\tslog.Info(\"Starting validation\",\n\t\t\"source_db\", c.SourceDB,\n\t\t\"replica_url\", c.ReplicaURL,\n\t\t\"check_type\", c.CheckType,\n\t\t\"ltx_continuity\", c.LTXContinuity,\n\t)\n\n\tresults := []ValidationResult{}\n\n\tif c.LTXContinuity && c.ReplicaURL != \"\" {\n\t\tresult := c.validateLTXContinuity(ctx)\n\t\tresults = append(results, result)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream-test/validate.go#L38-L74","documentation":"Argument validation error from `ValidateCommand.Run`: neither a `--replica-url` nor a `--config` file was supplied, so the command has no replication source to restore from. At least one of the two is required; this is returned right after the source DB check.","triggerScenarios":"Running `litestream-test validate --source-db app.db` with no replica or config; passing `--config` pointing to an empty/incorrect path where parsing silently yields no replica; typo in the flag name so it is not recognized and the value is dropped.","commonSituations":"Users migrating from older litestream-test versions whose flag names changed; validating with only restored-DB flags; config file present in cwd but not passed explicitly and defaults not pointing at it.","solutions":["Supply `--replica-url` (e.g. s3://bucket/db or file:///path)","Or supply `--config /etc/litestream.yml` describing the replica","Verify flag spelling (`--replica-url`, `--config`) — unknown flags may be silently ignored","Run `litestream-test validate --help` to confirm flag names"],"exampleFix":"// before\nlitestream-test validate --source-db app.db\n// after\nlitestream-test validate --source-db app.db --replica-url s3://bucket/db","handlingStrategy":"validation","validationCode":"if [ -z \"$REPLICA_URL\" ] && [ -z \"$CONFIG_PATH\" ]; then\n  echo \"provide --replica-url or --config\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one of --replica-url / --config","Verify config path is readable before invoking","Keep canonical validate commands in runbooks"],"tags":["cli","validation","missing-flag","litestream-test"],"backgroundTag":"missing-required-flag","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"}