{"record":{"id":"4ca33dbf6206db74","repo":"benbjohnson/litestream","slug":"validation-failed","errorCode":null,"errorMessage":"validation failed","messagePattern":"validation failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream-test/validate.go","lineNumber":459,"sourceCode":"\nfunc (c *ValidateCommand) reportResults(results []ValidationResult) error {\n\tallPassed := true\n\tfor _, result := range results {\n\t\tif !result.Passed {\n\t\t\tallPassed = false\n\t\t\tslog.Error(\"Validation failed\",\n\t\t\t\t\"check_type\", result.CheckType,\n\t\t\t\t\"error\", result.ErrorMessage,\n\t\t\t)\n\t\t}\n\t}\n\n\tif allPassed {\n\t\tslog.Info(\"All validation checks passed\")\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"validation failed\")\n}\n\nfunc (c *ValidateCommand) Usage() {\n\tfmt.Fprintln(c.Main.Stdout, `\nValidate replication integrity by restoring and checking databases.\n\nUsage:\n\n\tlitestream-test validate [options]\n\nOptions:\n\n\t-source-db PATH\n\t    Original database path (required)\n\n\t-replica-url URL\n\t    Replica URL to validate\n","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream-test/validate.go#L441-L477","documentation":"Sentinel result of `ValidateCommand.reportResults`: at least one post-restore validation check (row counts, checksums, etc.) did not match between the source database and the restored replica. Unlike the other errors it is not wrapped driver output — it is the tool's summary verdict that replication integrity failed. Check the preceding log output for which specific checks failed.","triggerScenarios":"Rows inserted into the source after the last replica sync but before validation; validation compared against a stale restored DB; replica LTX files missing or corrupted so restore is incomplete; comparing checksums of a DB that was legitimately modified between restore and check.","commonSituations":"Disaster-recovery drills where live writes continue during validation; detecting actual replication data loss; restored from an old generation while the source moved forward.","solutions":["Read the per-check failure lines logged by reportResults to see which checks mismatched","Quiesce writes to the source (or wait for `litestream replicate` to catch up) and re-run validation","Delete the stale `.restored` DB and restore fresh from the replica before validating","Inspect replica storage (`litestream ltx -level all`) for missing/damaged LTX files"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before validating, ensure replica is caught up\nlitestream replicate // wait / check status\nlitestream ltx // verify latest txid matches source","typeGuard":null,"tryCatchPattern":"if err := validateCmd.Run(ctx, args...); err != nil && err.Error() == \"validation failed\" {\n\t// parse earlier log lines for which checks mismatched\n\treturn fmt.Errorf(\"replication integrity check failed; see logs: %w\", err)\n}","preventionTips":["Quiesce writes or verify replica sync before validating","Always restore a fresh .restored DB instead of reusing one","Treat mismatches as real data loss until proven otherwise"],"tags":["replication","integrity","validation","disaster-recovery"],"backgroundTag":"schema-validation-failed","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"}