crowdsecurity/crowdsec · error
structured data must start with '[' or be '-'
Error message
structured data must start with '[' or be '-'
What it means
Returned by parseStructuredData when the STRUCTURED-DATA element is neither the NIL value '-' nor begins with '[' as RFC5424 requires. The first byte at the parse position after MSGID is some other character.
Source
Thrown at pkg/acquisition/modules/syslog/internal/parser/rfc5424/parse.go:256
return errors.New("msgid is empty")
}
if len(msgid) > 32 {
return errors.New("msgid is too long")
}
r.MsgID = string(msgid)
return nil
}
func (r *RFC5424) parseStructuredData() error {
done := false
if r.buf[r.position] == NIL_VALUE {
r.position += 2
return nil
}
if r.buf[r.position] != '[' {
return errors.New("structured data must start with '[' or be '-'")
}
prev := byte(0)
for r.position < r.len {
done = false
c := r.buf[r.position]
if c == ']' && prev != '\\' {
done = true
r.position++
if r.position < r.len && r.buf[r.position] == ' ' {
break
}
}
prev = c
r.position++
}
r.position++
if !done {
return errors.New("structured data must end with ']'")View on GitHub (pinned to 909b515798)
Solutions
- Emit '-' when the message has no structured data
- Start every STRUCTURED-DATA element with '[' and properly close it with ']'
- Verify the MSGID field before it is correctly terminated by a single space
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/acquisition/modules/syslog/internal/parser/rfc5424/parse.go:256 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/90825d9c97b625cb.
Report an issue: GitHub.