juicedata/juicefs · error
negative value for %s: %d
Error message
negative value for %s: %d
What it means
Returned by `juicefs config` when an integer flag (changelog-max-lines) is set to a negative number. Line-count limits cannot be negative, so the configuration update is refused before touching the volume format.
Source
Thrown at cmd/config.go:334
if new && format.ChangeLogMaxAge == 0 && !ctx.IsSet("changelog-max-age") {
format.ChangeLogMaxAge = 7200
msg.WriteString(fmt.Sprintf("%10s: 0s -> %s (default)\n", "changelog-max-age", time.Duration(7200)*time.Second))
}
}
case "changelog-max-age":
d := ctx.Duration(flag)
if d < 0 {
return fmt.Errorf("negative duration for %s: %s", flag, d)
}
newAge := int64(d.Seconds())
if newAge != format.ChangeLogMaxAge {
msg.WriteString(fmt.Sprintf("%10s: %s -> %s\n", flag, time.Duration(format.ChangeLogMaxAge)*time.Second, d))
format.ChangeLogMaxAge = newAge
}
case "changelog-max-lines":
if new := ctx.Int64(flag); new != format.ChangeLogMaxLines {
if new < 0 {
return fmt.Errorf("negative value for %s: %d", flag, new)
}
msg.WriteString(fmt.Sprintf("%10s: %d -> %d\n", flag, format.ChangeLogMaxLines, new))
format.ChangeLogMaxLines = new
}
case "user-group-quota":
if new := ctx.Bool(flag); new != format.UserGroupQuota {
msg.WriteString(fmt.Sprintf("%10s: %t -> %t\n", flag, format.UserGroupQuota, new))
format.UserGroupQuota = new
}
case "min-client-version":
if new := ctx.String(flag); new != format.MinClientVersion {
if version.Parse(new) == nil {
return fmt.Errorf("Invalid version string: %s", new)
}
if compareVersion(new, format.MinClientVersion) < 0 {
return fmt.Errorf("cannot lower min-client-version from %s to %s", format.MinClientVersion, new)
}
requireMinClientVersion(new)View on GitHub (pinned to c9a67b23e8)
Solutions
- Pass a non-negative integer, e.g. `--changelog-max-lines 100000`
- Use the default by not setting the flag
- Fix the script variable computing the limit
Example fix
// before juicefs config sqlite3://test.db --changelog-max-lines -1 // after juicefs config sqlite3://test.db --changelog-max-lines 10000
Defensive patterns
Strategy: validation
Validate before calling
if [ "$LINES" -lt 0 ]; then die "changelog-max-lines must be >= 0"; fi
Prevention
- Never encode 'unlimited' as a negative number
- Omit the flag to use defaults
- Validate int64 inputs before CLI calls
When it happens
Trigger: `juicefs config META --changelog-max-lines -100` or any negative int64 passed to the flag.
Common situations: Signed arithmetic in scripts producing negative limits; confusing 'unlimited' semantics with negative numbers (use 0/default instead).
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- changelog is not enabled, use `juicefs config %s --changelog
- tier should be between 0 and 3
- Invalid trash days: %d
- negative duration for %s: %s
- Invalid version string: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/a3c87848fd473828.
Report an issue: GitHub.