{"record":{"id":"d4a1743e262dadd4","repo":"AdguardTeam/AdGuardHome","slug":"applying-option-s-w","errorCode":null,"errorMessage":"applying option %s: %w","messagePattern":"applying option (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/home/options.go","lineNumber":436,"sourceCode":"\tif opt.updateWithValue != nil {\n\t\treturn applyOptWithValue(opt, next, o, eff, arg)\n\t}\n\n\treturn applyOptNoValue(opt, cmdName, o, eff, arg)\n}\n\n// applyOptNoValue applies option with no value.  eff must not be\n// nil.\nfunc applyOptNoValue(\n\topt cmdLineOpt,\n\tcmdName string,\n\to options,\n\teff effect,\n\targ string,\n) (newOpt options, newEff effect, err error) {\n\tnewOpts, newEff, err := updateOptsNoValue(o, eff, opt, cmdName)\n\tif err != nil {\n\t\treturn o, eff, fmt.Errorf(\"applying option %s: %w\", arg, err)\n\t}\n\n\treturn newOpts, newEff, nil\n}\n\n// applyOptWithValue applies argument with value.   next and eff must not\n// be nil.\nfunc applyOptWithValue(\n\topt cmdLineOpt,\n\tnext func() (int, string, bool),\n\to options,\n\teff effect,\n\targ string,\n) (newOpt options, newEff effect, err error) {\n\t_, val, ok := next()\n\tif !ok {\n\t\treturn o, eff, fmt.Errorf(\"got %s without argument\", arg)\n\t}","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/home/options.go#L418-L454","documentation":"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.","triggerScenarios":"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.","commonSituations":"Combining control flags (e.g. --install --uninstall) or repeating mode flags; version-dependent flag semantics changes.","solutions":["Read the inner error to see which rule was violated","Split conflicting operations into separate invocations","Consult --help for flag interactions"],"exampleFix":"# before\n./AdGuardHome --install --uninstall\n\n# after\n./AdGuardHome --uninstall\n# later:\n./AdGuardHome --install","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := parseCmdOpts(...); err != nil {\n    // inner error names the conflicting flag; surface it to the operator\n    return fmt.Errorf(\"flag error: %w\", err)\n}","preventionTips":["One service action per invocation","Review flag interactions in --help before combining boolean flags"],"tags":["go","cli","argument-parsing","flag-conflict"],"backgroundTag":"invalid-cli-argument","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}