benbjohnson/litestream · error
invalid -integrity-check value: %s
Error message
invalid -integrity-check value: %s
What it means
The `restore` command's -integrity-check flag only accepts the enum values "none", "quick", or "full", which map to litestream.IntegrityCheckNone/Quick/Full. Any other string fails the switch's default branch with this error. It is a strict enum validation of a CLI flag value.
Source
Thrown at cmd/litestream/restore.go:84
select {
case <-ch:
cancel()
case <-cancelCtx.Done():
}
}()
ctx = cancelCtx
defer cancel()
}
switch *integrityCheck {
case "none":
opt.IntegrityCheck = litestream.IntegrityCheckNone
case "quick":
opt.IntegrityCheck = litestream.IntegrityCheckQuick
case "full":
opt.IntegrityCheck = litestream.IntegrityCheckFull
default:
return fmt.Errorf("invalid -integrity-check value: %s", *integrityCheck)
}
// Parse timestamp, if specified.
if *timestampStr != "" {
if opt.Timestamp, err = time.Parse(time.RFC3339, *timestampStr); err != nil {
return errors.New("invalid -timestamp, must specify in ISO 8601 format (e.g. 2000-01-01T00:00:00Z)")
}
}
// Determine replica to restore from.
var r *litestream.Replica
if litestream.IsURL(fs.Arg(0)) {
if *configPath != "" {
return fmt.Errorf("cannot specify a replica URL and the -config flag")
}
if r, err = c.loadFromURL(ctx, fs.Arg(0), *ifDBNotExists, &opt); errors.Is(err, errSkipDBExists) {
slog.Info("database already exists, skipping")
return nilView on GitHub (pinned to 4ed7a308f6)
Solutions
- Use one of the exact lowercase values: -integrity-check none, quick, or full
- Default is fine to omit entirely if you don't need a custom level
- Check `litestream restore -h` for the accepted values
Example fix
// before litestream restore -integrity-check FULL -o out.db s3://bucket/prefix // after litestream restore -integrity-check full -o out.db s3://bucket/prefix
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"none": true, "quick": true, "full": true}
if !valid[integrityCheck] {
return fmt.Errorf("-integrity-check must be none|quick|full, got %q", integrityCheck)
} Prevention
- Use the exact lowercase enum strings
- Check `litestream restore -h` for accepted values
- Keep flag values in shell variables sourced from a validated allowlist
When it happens
Trigger: `litestream restore -integrity-check <value> ...` where value is not exactly none|quick|full — e.g. "NONE", "off", "true", "basic", or a misspelling like "quik".
Common situations: Case-sensitivity surprises (NONE vs none); assuming boolean-style values (true/false); copying flags from other sqlite tools that use different integrity-check vocabularies.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- cannot specify a replica URL and the -config flag
- cannot use -dry-run with -f
- invalid -timestamp, must specify in ISO 8601 format (e.g. 20
- cannot specify a replica URL and the -config flag
- cannot specify -once flag with -exec
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/6711b1638aeb4b3c.
Report an issue: GitHub.