coredns/coredns · error
continue rule must begin with a rule type
Error message
continue rule must begin with a rule type
What it means
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.
Source
Thrown at plugin/rewrite/rewrite.go:108
Rewrite(ctx context.Context, state request.Request) (ResponseRules, Result)
// Mode returns the processing mode stop or continue.
Mode() string
}
func newRule(args ...string) (Rule, error) {
if len(args) == 0 {
return nil, fmt.Errorf("no rule type specified for rewrite")
}
arg0 := strings.ToLower(args[0])
var ruleType string
var expectNumArgs, startArg int
mode := Stop
switch arg0 {
case Continue:
mode = Continue
if len(args) < 2 {
return nil, fmt.Errorf("continue rule must begin with a rule type")
}
ruleType = strings.ToLower(args[1])
expectNumArgs = len(args) - 1
startArg = 2
case Stop:
if len(args) < 2 {
return nil, fmt.Errorf("stop rule must begin with a rule type")
}
ruleType = strings.ToLower(args[1])
expectNumArgs = len(args) - 1
startArg = 2
default:
// for backward compatibility
ruleType = arg0
expectNumArgs = len(args)
startArg = 1
}
View on GitHub (pinned to 558c9757a9)
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`.
Example fix
// before (Corefile) rewrite continue // after rewrite continue name a.example.org b.example.org
Defensive patterns
Strategy: validation
Validate before calling
if strings.EqualFold(args[0], "continue") && len(args) < 2 {
return fmt.Errorf("'continue' must be followed by a rule type")
} Prevention
- 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.
When it happens
Trigger: newRule called with args == ["continue"] — e.g. a Corefile line `rewrite continue` where the rule type token is missing; expectNumArgs/startArg cannot be computed.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- no rule type specified for rewrite
- stop rule must begin with a rule type
- too few arguments for a name rule
- invalid arguments for %s rule
- type missing for answer rule for %s rule
AI-assisted analysis of coredns/coredns@558c9757a9 (2026-09-06).
Data as JSON: /api/errors/f9522bea5086bfef.
Report an issue: GitHub.