{"record":{"id":"0af8eed31576ccbb","repo":"coredns/coredns","slug":"unknown-flag-action-s-should-be-set-or-clear","errorCode":null,"errorMessage":"unknown flag action=%s, should be set or clear","messagePattern":"unknown flag action=(.+?), should be set or clear","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/header/header.go","lineNumber":63,"sourceCode":"\nfunc newRules(key string, args []string) ([]Rule, error) {\n\tif key == \"\" {\n\t\treturn nil, fmt.Errorf(\"no flag action provided\")\n\t}\n\n\tif len(args) < 1 {\n\t\treturn nil, fmt.Errorf(\"invalid length for flags, at least one should be provided\")\n\t}\n\n\tvar state bool\n\taction := strings.ToLower(key)\n\tswitch action {\n\tcase \"set\":\n\t\tstate = true\n\tcase \"clear\":\n\t\tstate = false\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown flag action=%s, should be set or clear\", action)\n\t}\n\n\trules := make([]Rule, 0, len(args))\n\tfor _, arg := range args {\n\t\tflag := strings.ToLower(arg)\n\t\tswitch flag {\n\t\tcase authoritative:\n\t\tcase recursionAvailable:\n\t\tcase recursionDesired:\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown/unsupported flag=%s\", flag)\n\t\t}\n\t\trule := Rule{Flag: flag, State: state}\n\t\trules = append(rules, rule)\n\t}\n\n\treturn rules, nil\n}","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/coredns/coredns/blob/558c9757a92b361e550bdba82d0b4ddf3d12d595/plugin/header/header.go#L45-L81","documentation":"Configuration error in the header plugin's newRules. The action keyword is neither 'set' nor 'clear' (case-insensitive), so the rule's boolean state cannot be determined; Corefile setup fails with the offending action named.","triggerScenarios":"A header stanza uses an unsupported action keyword, e.g. 'header { add DO }' or 'unset DO'.","commonSituations":"Users guess at action names borrowed from other plugins/HTTP header tools ('add', 'delete', 'unset'); typos like 'ste' or 'claer'.","solutions":["Use only 'set' or 'clear' as the action keyword.","Fix typos in the action word (check the error's action=%s value).","Consult the header plugin documentation for supported actions and flags."],"exampleFix":"// before\nheader {\n    unset DO\n}\n// after\nheader {\n    clear DO\n}","handlingStrategy":"validation","validationCode":"switch strings.ToLower(action) {\ncase \"set\", \"clear\":\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported header action %q; use set or clear\", action)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict actions to set/clear","Avoid borrowing keywords from other header-manipulation tools","Lint the Corefile against documented plugin syntax"],"tags":["coredns","header","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"558c9757a92b361e550bdba82d0b4ddf3d12d595","analyzedAt":"2026-09-06T22:47:02.106Z","contentChangedAt":"2026-09-06T22:47:02.106Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}