AdguardTeam/AdGuardHome · error

applying option %s: %w

Error message

applying option %s: %w

What it means

A valueless (boolean-style) command-line option failed while being applied. applyOptNoValue wraps errors from the option's update handler, e.g. conflicting flags like combining --no-check-update with update settings or --install/uninstall style effects.

Source

Thrown at internal/home/options.go:436

	if opt.updateWithValue != nil {
		return applyOptWithValue(opt, next, o, eff, arg)
	}

	return applyOptNoValue(opt, cmdName, o, eff, arg)
}

// applyOptNoValue applies option with no value.  eff must not be
// nil.
func applyOptNoValue(
	opt cmdLineOpt,
	cmdName string,
	o options,
	eff effect,
	arg string,
) (newOpt options, newEff effect, err error) {
	newOpts, newEff, err := updateOptsNoValue(o, eff, opt, cmdName)
	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)
	}

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Read the inner error to see which rule was violated
  2. Split conflicting operations into separate invocations
  3. Consult --help for flag interactions

Example fix

# before
./AdGuardHome --install --uninstall

# after
./AdGuardHome --uninstall
# later:
./AdGuardHome --install
Defensive patterns

Strategy: try-catch

Try / catch

if err := parseCmdOpts(...); err != nil {
    // inner error names the conflicting flag; surface it to the operator
    return fmt.Errorf("flag error: %w", err)
}

Prevention

When it happens

Trigger: Passing a boolean flag whose effect conflicts with current state or other flags — for example specifying mutually exclusive service action flags together on one command line.

Common situations: Combining control flags (e.g. --install --uninstall) or repeating mode flags; version-dependent flag semantics changes.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/d4a1743e262dadd4. Report an issue: GitHub.