{"record":{"id":"be3132eab566037d","repo":"AdguardTeam/AdGuardHome","slug":"w-q","errorCode":null,"errorMessage":"%w: %q","messagePattern":"%w: %q","errorType":"validation","errorClass":"errors.ErrBadEnumValue","httpStatus":null,"severity":"error","filePath":"internal/home/service.go","lineNumber":258,"sourceCode":"\t\treturn handleServiceInstallCmd(ctx, l, mgr, opts, workDir, confPath)\n\tcase \"uninstall\":\n\t\taction = &ossvc.ActionUninstall{\n\t\t\tServiceName: serviceName,\n\t\t}\n\tcase \"start\":\n\t\taction = &ossvc.ActionStart{\n\t\t\tServiceName: serviceName,\n\t\t}\n\tcase \"stop\":\n\t\taction = &ossvc.ActionStop{\n\t\t\tServiceName: serviceName,\n\t\t}\n\tcase \"restart\":\n\t\taction = &ossvc.ActionRestart{\n\t\t\tServiceName: serviceName,\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"%w: %q\", errors.ErrBadEnumValue, opts.serviceControlAction)\n\t}\n\n\treturn mgr.Perform(ctx, action)\n}\n\n// handleServiceStatusCmd logs the service's status.  l and mgr must not be\n// nil.\nfunc handleServiceStatusCmd(ctx context.Context, l *slog.Logger, mgr ossvc.Manager) (err error) {\n\tstatus, err := mgr.Status(ctx, serviceName)\n\tif err != nil {\n\t\t// Don't wrap the error, since it's informative enough as is.\n\t\treturn err\n\t}\n\n\tswitch status {\n\tcase ossvc.StatusNotInstalled:\n\t\tl.InfoContext(ctx, \"not installed\")\n\tcase ossvc.StatusStopped:","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/home/service.go#L240-L276","documentation":"handleServiceCommand received a serviceControlAction that isn't one of the known verbs (start/stop/restart), so the action variable can't be constructed and errors.ErrBadEnumValue is wrapped with the offending value.","triggerScenarios":"Passing an unrecognized subcommand to -s, e.g. ./AdGuardHome -s reload or -s pause; the string falls through the switch's default case.","commonSituations":"Users assuming actions like 'reload' or 'status' route through this handler, typos, or scripts written against different service CLIs (nginx -s reload style muscle memory).","solutions":["Use only: start, stop, restart (status is handled elsewhere but also valid via -s status)","Check spelling of the action verb","Run ./AdGuardHome --help to see the supported -s values"],"exampleFix":"# before\n./AdGuardHome -s reload\n\n# after\n./AdGuardHome -s restart","handlingStrategy":"validation","validationCode":"var validActions = map[string]bool{\"start\":true,\"stop\":true,\"restart\":true}\nif !validActions[opts.serviceControlAction] {\n    return fmt.Errorf(\"unsupported action %q; use start|stop|restart\", opts.serviceControlAction)\n}","typeGuard":"func isServiceCommand(s string) bool {\n    switch s { case \"start\", \"stop\", \"restart\": return true }; return false\n}","tryCatchPattern":null,"preventionTips":["Use only documented -s verbs","Remember 'reload' is not supported — use 'restart'"],"tags":["go","cli","service","enum-validation"],"backgroundTag":"enum-value-validation-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}