{"record":{"id":"f11e3505649c68e7","repo":"juicedata/juicefs","slug":"option-s-requires-a-value","errorCode":null,"errorMessage":"option %s requires a value","messagePattern":"option (.+?) requires a value","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/main.go","lineNumber":177,"sourceCode":"\t\t\topt = strings.TrimSpace(opt)\n\t\t\tif opt == \"\" || opt == \"background\" || utils.StringContains(sysOptions, opt) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Lower case option name is preferred, but if it's the same as flag name, we also accept it\n\t\t\tif strings.Contains(opt, \"=\") {\n\t\t\t\tfields := strings.SplitN(opt, \"=\", 2)\n\t\t\t\tif flagName, ok := optionToCmdFlag[fields[0]]; ok {\n\t\t\t\t\tnewArgs = append(newArgs, fmt.Sprintf(\"--%s=%s\", flagName, fields[1]))\n\t\t\t\t} else if _, ok := cmdFlagsLookup[fields[0]]; ok {\n\t\t\t\t\tnewArgs = append(newArgs, fmt.Sprintf(\"--%s=%s\", fields[0], fields[1]))\n\t\t\t\t} else {\n\t\t\t\t\tfuseOptions = append(fuseOptions, opt)\n\t\t\t\t}\n\t\t\t} else if flagName, ok := optionToCmdFlag[opt]; ok {\n\t\t\t\tnewArgs = append(newArgs, fmt.Sprintf(\"--%s\", flagName))\n\t\t\t} else if isBool, ok := cmdFlagsLookup[opt]; ok {\n\t\t\t\tif !isBool {\n\t\t\t\t\treturn nil, fmt.Errorf(\"option %s requires a value\", opt)\n\t\t\t\t}\n\t\t\t\tnewArgs = append(newArgs, fmt.Sprintf(\"--%s\", opt))\n\t\t\t\tif opt == \"debug\" {\n\t\t\t\t\tfuseOptions = append(fuseOptions, opt)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfuseOptions = append(fuseOptions, opt)\n\t\t\t}\n\t\t}\n\n\t\tparseFlag = false\n\t}\n\tif len(fuseOptions) > 0 {\n\t\tnewArgs = append(newArgs, \"-o\", strings.Join(fuseOptions, \",\"))\n\t}\n\tnewArgs = append(newArgs, args[1], args[2])\n\tlogger.Debug(\"Parsed mount args: \", strings.Join(newArgs, \" \"))\n\treturn newArgs, nil","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/main.go#L159-L195","documentation":"Returned while rewriting FUSE-style mount options into CLI flags (handleSysMountArgs) when an -o token is a bare name that is neither a known no-arg option nor a known JuiceFS flag. The option requires a value which was not supplied in 'name=value' form, so the mount arguments are rejected up front.","triggerScenarios":"Thrown at cmd/main.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the option in name=value form, e.g. -o cache-size=2048","Check the option name against supported mount options"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for i, a := range args {\n    if strings.HasPrefix(a, \"--\") {\n        if v, ok := valueFlags[a]; ok && (i+1 >= len(args) || strings.HasPrefix(args[i+1], \"--\")) {\n            return fmt.Errorf(\"%s requires a value\", a)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := mountCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"requires a value\") {\n        log.Fatalf(\"supply the option's value: %v\", err)\n    }\n}","preventionTips":["Always pass value-taking flags as --flag value pairs in scripts and fstab","Interpolate variables safely and assert they are non-empty before building the command","Check `juicefs mount --help` to distinguish boolean flags from value flags"],"tags":[],"backgroundTag":null,"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"}