{"record":{"id":"a3c87848fd473828","repo":"juicedata/juicefs","slug":"negative-value-for-s-d","errorCode":null,"errorMessage":"negative value for %s: %d","messagePattern":"negative value for (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/config.go","lineNumber":334,"sourceCode":"\t\t\t\tif new && format.ChangeLogMaxAge == 0 && !ctx.IsSet(\"changelog-max-age\") {\n\t\t\t\t\tformat.ChangeLogMaxAge = 7200\n\t\t\t\t\tmsg.WriteString(fmt.Sprintf(\"%10s: 0s -> %s (default)\\n\", \"changelog-max-age\", time.Duration(7200)*time.Second))\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"changelog-max-age\":\n\t\t\td := ctx.Duration(flag)\n\t\t\tif d < 0 {\n\t\t\t\treturn fmt.Errorf(\"negative duration for %s: %s\", flag, d)\n\t\t\t}\n\t\t\tnewAge := int64(d.Seconds())\n\t\t\tif newAge != format.ChangeLogMaxAge {\n\t\t\t\tmsg.WriteString(fmt.Sprintf(\"%10s: %s -> %s\\n\", flag, time.Duration(format.ChangeLogMaxAge)*time.Second, d))\n\t\t\t\tformat.ChangeLogMaxAge = newAge\n\t\t\t}\n\t\tcase \"changelog-max-lines\":\n\t\t\tif new := ctx.Int64(flag); new != format.ChangeLogMaxLines {\n\t\t\t\tif new < 0 {\n\t\t\t\t\treturn fmt.Errorf(\"negative value for %s: %d\", flag, new)\n\t\t\t\t}\n\t\t\t\tmsg.WriteString(fmt.Sprintf(\"%10s: %d -> %d\\n\", flag, format.ChangeLogMaxLines, new))\n\t\t\t\tformat.ChangeLogMaxLines = new\n\t\t\t}\n\t\tcase \"user-group-quota\":\n\t\t\tif new := ctx.Bool(flag); new != format.UserGroupQuota {\n\t\t\t\tmsg.WriteString(fmt.Sprintf(\"%10s: %t -> %t\\n\", flag, format.UserGroupQuota, new))\n\t\t\t\tformat.UserGroupQuota = new\n\t\t\t}\n\t\tcase \"min-client-version\":\n\t\t\tif new := ctx.String(flag); new != format.MinClientVersion {\n\t\t\t\tif version.Parse(new) == nil {\n\t\t\t\t\treturn fmt.Errorf(\"Invalid version string: %s\", new)\n\t\t\t\t}\n\t\t\t\tif compareVersion(new, format.MinClientVersion) < 0 {\n\t\t\t\t\treturn fmt.Errorf(\"cannot lower min-client-version from %s to %s\", format.MinClientVersion, new)\n\t\t\t\t}\n\t\t\t\trequireMinClientVersion(new)","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/config.go#L316-L352","documentation":"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.","triggerScenarios":"`juicefs config META --changelog-max-lines -100` or any negative int64 passed to the flag.","commonSituations":"Signed arithmetic in scripts producing negative limits; confusing 'unlimited' semantics with negative numbers (use 0/default instead).","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"],"exampleFix":"// before\njuicefs config sqlite3://test.db --changelog-max-lines -1\n// after\njuicefs config sqlite3://test.db --changelog-max-lines 10000","handlingStrategy":"validation","validationCode":"if [ \"$LINES\" -lt 0 ]; then die \"changelog-max-lines must be >= 0\"; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never encode 'unlimited' as a negative number","Omit the flag to use defaults","Validate int64 inputs before CLI calls"],"tags":["cli","validation","changelog"],"backgroundTag":"invalid-config-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}