caddyserver/caddy · error
too many '<' for heredoc on line #%d; only use two, for exam
Error message
too many '<' for heredoc on line #%d; only use two, for example <<END
What it means
The heredoc opener used three or more '<' characters (e.g. <<<EOF). Caddy heredocs use exactly two: <<MARKER. Three-angle heredocs are a bash-ism ('here-string') that Caddy does not support.
Source
Thrown at caddyconfig/caddyfile/lexer.go:163
}
// skip CR, we only care about LF
if ch == '\r' {
continue
}
// after hitting a newline, we know that the heredoc marker
// is the characters after the two << and the newline.
// we reset the val because the heredoc is syntax we don't
// want to keep.
if ch == '\n' {
if len(val) == 2 {
return false, fmt.Errorf("missing opening heredoc marker on line #%d; must contain only alphanumeric characters, dashes and underscores; got empty string", l.line)
}
// check if there's too many <
if string(val[:3]) == "<<<" {
return false, fmt.Errorf("too many '<' for heredoc on line #%d; only use two, for example <<END", l.line)
}
heredocMarker = string(val[2:])
if !heredocMarkerRegexp.Match([]byte(heredocMarker)) {
return false, fmt.Errorf("heredoc marker on line #%d must contain only alphanumeric characters, dashes and underscores; got '%s'", l.line, heredocMarker)
}
inHeredoc = true
l.skippedLines++
val = nil
continue
}
val = append(val, ch)
continue
}
// if we're in a heredoc, all characters are read as-is
if inHeredoc {View on GitHub (pinned to 50e54ee279)
Solutions
- Change <<<MARKER to <<MARKER
- If a here-string was intended, inline the value directly as a normal argument instead
Example fix
# before respond <<<EOF # after respond <<EOF
Defensive patterns
Strategy: validation
Validate before calling
if strings.Contains(line, "<<<") {
return fmt.Errorf("three-angle heredoc not supported: %q", line)
} Prevention
- Use exactly two '<' for heredocs
- Don't paste shell here-strings into Caddyfiles
When it happens
Trigger: A Caddyfile line contains '<<<' before the marker on the opening heredoc line; the lexer detects val[:3] == "<<<" when the newline arrives.
Common situations: Copy-pasting shell scripts or examples that use <<< into a Caddyfile directive, or muscle memory from bash here-strings.
Related errors
- incomplete heredoc <<%s on line #%d, expected ending marker
- missing opening heredoc marker on line #%d; must contain onl
- heredoc marker on line #%d must contain only alphanumeric ch
- mismatched leading whitespace in heredoc <<%s on line #%d [%
- invalid action type
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/60e908f6c94d9c1f.
Report an issue: GitHub.