{"record":{"id":"17e34152d7a84ad3","repo":"benbjohnson/litestream","slug":"unsupported-integrity-check-mode-d","errorCode":null,"errorMessage":"unsupported integrity check mode: %d","messagePattern":"unsupported integrity check mode: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"replica.go","lineNumber":619,"sourceCode":"// a timestamp can be specified to restore the database to a specific\n// point-in-time.\n//\n// When the replica contains both v0.3.x and LTX format backups, this method\n// compares snapshots from both formats and uses whichever has the better backup:\n// - With timestamp: uses the format with the most recent snapshot before timestamp\n// - Without timestamp: uses the format with the most recent backup overall\nfunc (r *Replica) Restore(ctx context.Context, opt RestoreOptions) (err error) {\n\t// Validate options.\n\tif opt.OutputPath == \"\" {\n\t\treturn fmt.Errorf(\"output path required\")\n\t} else if opt.TXID != 0 && !opt.Timestamp.IsZero() {\n\t\treturn fmt.Errorf(\"cannot specify index & timestamp to restore\")\n\t} else if opt.Follow && opt.TXID != 0 {\n\t\treturn fmt.Errorf(\"cannot use follow mode with -txid\")\n\t} else if opt.Follow && !opt.Timestamp.IsZero() {\n\t\treturn fmt.Errorf(\"cannot use follow mode with -timestamp\")\n\t} else if opt.IntegrityCheck != IntegrityCheckNone && opt.IntegrityCheck != IntegrityCheckQuick && opt.IntegrityCheck != IntegrityCheckFull {\n\t\treturn fmt.Errorf(\"unsupported integrity check mode: %d\", opt.IntegrityCheck)\n\t}\n\n\t// In follow mode, if the database already exists, attempt crash recovery\n\t// by reading the last applied TXID from the sidecar file.\n\tif opt.Follow {\n\t\tif _, statErr := os.Stat(opt.OutputPath); statErr == nil {\n\t\t\ttxid, readErr := ReadTXIDFile(opt.OutputPath)\n\t\t\tif readErr != nil {\n\t\t\t\treturn fmt.Errorf(\"read txid file for crash recovery: %w\", readErr)\n\t\t\t}\n\t\t\tif txid == 0 {\n\t\t\t\treturn fmt.Errorf(\"cannot resume follow mode: database exists but no -txid file found; delete the database to re-restore: %s\", opt.OutputPath)\n\t\t\t}\n\t\t\t// Validate saved TXID is still reachable. If the earliest snapshot\n\t\t\t// starts after our saved TXID, retention has pruned the history\n\t\t\t// and we can't catch up incrementally.\n\t\t\tsnapshotItr, itrErr := r.Client.LTXFiles(ctx, SnapshotLevel, 0, false)\n\t\t\tif itrErr != nil {","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/replica.go#L601-L637","documentation":"Restore option guard: opt.IntegrityCheck is not one of the supported enum values (IntegrityCheckNone, IntegrityCheckQuick, IntegrityCheckFull). An out-of-range numeric mode was passed programmatically or via config.","triggerScenarios":"Thrown at replica.go:619 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported integrity check modes: none, quick, or full"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}