{"record":{"id":"f9522bea5086bfef","repo":"coredns/coredns","slug":"continue-rule-must-begin-with-a-rule-type","errorCode":null,"errorMessage":"continue rule must begin with a rule type","messagePattern":"continue rule must begin with a rule type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/rewrite/rewrite.go","lineNumber":108,"sourceCode":"\tRewrite(ctx context.Context, state request.Request) (ResponseRules, Result)\n\t// Mode returns the processing mode stop or continue.\n\tMode() string\n}\n\nfunc newRule(args ...string) (Rule, error) {\n\tif len(args) == 0 {\n\t\treturn nil, fmt.Errorf(\"no rule type specified for rewrite\")\n\t}\n\n\targ0 := strings.ToLower(args[0])\n\tvar ruleType string\n\tvar expectNumArgs, startArg int\n\tmode := Stop\n\tswitch arg0 {\n\tcase Continue:\n\t\tmode = Continue\n\t\tif len(args) < 2 {\n\t\t\treturn nil, fmt.Errorf(\"continue rule must begin with a rule type\")\n\t\t}\n\t\truleType = strings.ToLower(args[1])\n\t\texpectNumArgs = len(args) - 1\n\t\tstartArg = 2\n\tcase Stop:\n\t\tif len(args) < 2 {\n\t\t\treturn nil, fmt.Errorf(\"stop rule must begin with a rule type\")\n\t\t}\n\t\truleType = strings.ToLower(args[1])\n\t\texpectNumArgs = len(args) - 1\n\t\tstartArg = 2\n\tdefault:\n\t\t// for backward compatibility\n\t\truleType = arg0\n\t\texpectNumArgs = len(args)\n\t\tstartArg = 1\n\t}\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/coredns/coredns/blob/558c9757a92b361e550bdba82d0b4ddf3d12d595/plugin/rewrite/rewrite.go#L90-L126","documentation":"A rewrite rule may be prefixed with the mode 'continue'. When the first argument is 'continue', a second argument naming the actual rule type (name, cname, rcode...) must follow. This error is returned when 'continue' is the last token, so there is no rule type to dispatch on.","triggerScenarios":"newRule called with args == [\"continue\"] — e.g. a Corefile line `rewrite continue` where the rule type token is missing; expectNumArgs/startArg cannot be computed.","commonSituations":"Truncated Corefile lines after editing; line-wrapping that splits the rule type onto another line without proper continuation; forgetting the rule type after changing mode from stop to continue.","solutions":["Append the rule type and its arguments after 'continue': `rewrite continue name a.example.org b.example.org`.","Check that the Corefile line was not truncated or wrapped incorrectly.","Validate the config at startup with `coredns -conf Corefile`."],"exampleFix":"// before (Corefile)\nrewrite continue\n// after\nrewrite continue name a.example.org b.example.org","handlingStrategy":"validation","validationCode":"if strings.EqualFold(args[0], \"continue\") && len(args) < 2 {\n    return fmt.Errorf(\"'continue' must be followed by a rule type\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write mode and rule type together: `rewrite continue name ...`.","Check for truncated or line-wrapped Corefile directives after edits.","Run config validation at startup; CoreDNS fails fast on this error."],"tags":["coredns","rewrite-plugin","configuration","missing-argument"],"backgroundTag":"missing-required-argument","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"}