{"record":{"id":"e5baa5c7d5c4a20c","repo":"juicedata/juicefs","slug":"tier-should-be-between-0-and-3","errorCode":null,"errorMessage":"tier should be between 0 and 3","messagePattern":"tier should be between 0 and 3","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/config.go","lineNumber":121,"sourceCode":"\t\t&cli.DurationFlag{\n\t\t\tName:        \"changelog-max-age\",\n\t\t\tUsage:       \"max age of changelog entries (e.g. 2h, 30m); 0 to disable time-based cleanup\",\n\t\t\tValue:       2 * time.Hour,\n\t\t\tDefaultText: \"2h\",\n\t\t},\n\t\t&cli.Int64Flag{\n\t\t\tName:  \"changelog-max-lines\",\n\t\t\tUsage: \"max number of changelog entries to keep; 0 means unlimited\",\n\t\t},\n\t\t&cli.IntFlag{\n\t\t\tName:  \"tier\",\n\t\t\tUsage: \"tier (0-3; 0 is default tier when unset)\",\n\t\t\tAction: func(ctx *cli.Context, v int) error {\n\t\t\t\tif !ctx.IsSet(\"tier\") {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif v < 0 || v > 3 {\n\t\t\t\t\treturn fmt.Errorf(\"tier should be between 0 and 3\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t})\n}\n\nfunc configFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\t&cli.BoolFlag{\n\t\t\tName:    \"yes\",\n\t\t\tAliases: []string{\"y\"},\n\t\t\tUsage:   \"automatically answer 'yes' to all prompts and run non-interactively\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName:  \"force\",\n\t\t\tUsage: \"skip sanity check and force update the configurations\",\n\t\t},","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/config.go#L103-L139","documentation":"This is a flag-level Action validator for the `--tier` option of `juicefs config`. It rejects any tier value outside 0-3, since JuiceFS only defines four data tiers. The error surfaces before any config change is applied.","triggerScenarios":"`juicefs config META --tier 4` (or negative), i.e. setting a cache tier outside the supported 0-3 range while the --tier flag is explicitly set.","commonSituations":"Typo or misunderstanding that tiers start at 0; scripting tier values computed elsewhere that exceed 3.","solutions":["Pass a tier value in 0..3, e.g. `--tier 1`","Omit the flag entirely (unset means default tier 0)","Clamp computed tier values in your script to the 0-3 range"],"exampleFix":"// before\njuicefs config sqlite3://test.db --tier 5\n// after\njuicefs config sqlite3://test.db --tier 3","handlingStrategy":"validation","validationCode":"tier = max(0, min(3, tier))\nif tier < 0 || tier > 3 { die \"tier must be 0-3\" }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp tier values to 0-3 in scripts","Remember tiers are 0-based","Consult `juicefs config --help` for valid ranges"],"tags":["cli","validation","tier"],"backgroundTag":"invalid-cli-argument","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}