AdguardTeam/AdGuardHome · error
got %s without argument
Error message
got %s without argument
What it means
A command-line option that requires a value was the last token on the command line, so the iterator next() returned no value. applyOptWithValue reports which flag is missing its argument.
Source
Thrown at internal/home/options.go:453
if err != nil {
return o, eff, fmt.Errorf("applying option %s: %w", arg, err)
}
return newOpts, newEff, nil
}
// applyOptWithValue applies argument with value. next and eff must not
// be nil.
func applyOptWithValue(
opt cmdLineOpt,
next func() (int, string, bool),
o options,
eff effect,
arg string,
) (newOpt options, newEff effect, err error) {
_, val, ok := next()
if !ok {
return o, eff, fmt.Errorf("got %s without argument", arg)
}
newOpts, err := opt.updateWithValue(o, val)
if err != nil {
return o, eff, fmt.Errorf("applying option %s: %w", arg, err)
}
return newOpts, eff, nil
}
// findMatchingOpt returns cmdLineOpt which matches the given arg. ok indicates
// whether the appropriate option was found.
func findMatchingOpt(arg string) (opt cmdLineOpt, ok bool) {
for _, opt := range cmdLineOpts {
if argMatches(opt, arg) {
return opt, true
}
}View on GitHub (pinned to b41aefbe51)
Solutions
- Append the required value after the flag: -c /path/to/config.yaml
- Quote and default empty shell variables: -w "${WORKDIR:-/var/lib/adguardhome}"
- Validate generated command lines in scripts before executing
Example fix
# before ./AdGuardHome -c # after ./AdGuardHome -c /etc/adguardhome.yaml
Defensive patterns
Strategy: validation
Validate before calling
// Ensure value-taking flags are never last:
if strings.HasPrefix(arg, "-") && i == len(args)-1 && requiresValue(arg) {
return fmt.Errorf("flag %s needs a value", arg)
} Prevention
- Default empty shell variables: ${CFG:-/etc/adguardhome.yaml} Quote variables in service units and scripts
When it happens
Trigger: Ending argv with a value-taking flag: ./AdGuardHome -c or ./AdGuardHome --workdir with nothing after it.
Common situations: Shell scripts where a variable expands to empty (-w "$WORKDIR" with WORKDIR unset), or truncated command lines in service unit files.
Related errors
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/eb6fe0fbe69d41aa.
Report an issue: GitHub.