{"record":{"id":"9798f7c0b46e3798","repo":"benbjohnson/litestream","slug":"source-database-path-required","errorCode":null,"errorMessage":"source database path required","messagePattern":"source database path required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream-test/validate.go","lineNumber":52,"sourceCode":"\tErrorMessage string\n\tDetails      map[string]interface{}\n}\n\nfunc (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{}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream-test/validate.go#L34-L70","documentation":"Argument validation error from `ValidateCommand.Run` in the litestream-test CLI: the `--source-db` flag was not provided, but it is mandatory — validate needs the source database to compare against a restored replica. Run returns this immediately after flag parsing, before any validation work starts.","triggerScenarios":"Running `litestream-test validate` with only `--replica-url` or `--config` but no `--source-db`; forgetting the flag when invoking from a script; assuming a positional argument sets the source (it does not — flags only).","commonSituations":"CI scripts templated from the restore command where the source DB was passed positionally; first-time users omitting `--source-db`; config file providing replica info but never the source path.","solutions":["Add `--source-db /path/to/app.db` to the validate command","Check `litestream-test validate --help` for required flags","If using a config file, still supply `--source-db` (config does not replace it)"],"exampleFix":"// before\nlitestream-test validate --replica-url s3://bucket/db\n// after\nlitestream-test validate --source-db /var/lib/app/app.db --replica-url s3://bucket/db","handlingStrategy":"validation","validationCode":"if [ -z \"$SOURCE_DB\" ] || [ ! -f \"$SOURCE_DB\" ]; then\n  echo \"--source-db required and must exist\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert required flags in wrapper scripts","Confirm file exists before validate","Mirror the flag set from validate --help in CI"],"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"}