juicedata/juicefs · error
option %s requires a value
Error message
option %s requires a value
What it means
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.
Source
Thrown at cmd/main.go:177
opt = strings.TrimSpace(opt)
if opt == "" || opt == "background" || utils.StringContains(sysOptions, opt) {
continue
}
// Lower case option name is preferred, but if it's the same as flag name, we also accept it
if strings.Contains(opt, "=") {
fields := strings.SplitN(opt, "=", 2)
if flagName, ok := optionToCmdFlag[fields[0]]; ok {
newArgs = append(newArgs, fmt.Sprintf("--%s=%s", flagName, fields[1]))
} else if _, ok := cmdFlagsLookup[fields[0]]; ok {
newArgs = append(newArgs, fmt.Sprintf("--%s=%s", fields[0], fields[1]))
} else {
fuseOptions = append(fuseOptions, opt)
}
} else if flagName, ok := optionToCmdFlag[opt]; ok {
newArgs = append(newArgs, fmt.Sprintf("--%s", flagName))
} else if isBool, ok := cmdFlagsLookup[opt]; ok {
if !isBool {
return nil, fmt.Errorf("option %s requires a value", opt)
}
newArgs = append(newArgs, fmt.Sprintf("--%s", opt))
if opt == "debug" {
fuseOptions = append(fuseOptions, opt)
}
} else {
fuseOptions = append(fuseOptions, opt)
}
}
parseFlag = false
}
if len(fuseOptions) > 0 {
newArgs = append(newArgs, "-o", strings.Join(fuseOptions, ","))
}
newArgs = append(newArgs, args[1], args[2])
logger.Debug("Parsed mount args: ", strings.Join(newArgs, " "))
return newArgs, nilView on GitHub (pinned to c9a67b23e8)
Solutions
- Pass the option in name=value form, e.g. -o cache-size=2048
- Check the option name against supported mount options
Defensive patterns
Strategy: validation
Validate before calling
for i, a := range args {
if strings.HasPrefix(a, "--") {
if v, ok := valueFlags[a]; ok && (i+1 >= len(args) || strings.HasPrefix(args[i+1], "--")) {
return fmt.Errorf("%s requires a value", a)
}
}
} Try / catch
if err := mountCmd.Run(); err != nil {
if strings.Contains(err.Error(), "requires a value") {
log.Fatalf("supply the option's value: %v", err)
}
} Prevention
- 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
When it happens
Trigger: Thrown at cmd/main.go:177 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/f11e3505649c68e7.
Report an issue: GitHub.