{"record":{"id":"c0639971c29a32d3","repo":"crowdsecurity/crowdsec","slug":"structured-data-must-end-with","errorCode":null,"errorMessage":"structured data must end with ']'","messagePattern":"structured data must end with '\\]'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/syslog/internal/parser/rfc5424/parse.go","lineNumber":274,"sourceCode":"\t\treturn errors.New(\"structured data must start with '[' or be '-'\")\n\t}\n\tprev := byte(0)\n\tfor r.position < r.len {\n\t\tdone = false\n\t\tc := r.buf[r.position]\n\t\tif c == ']' && prev != '\\\\' {\n\t\t\tdone = true\n\t\t\tr.position++\n\t\t\tif r.position < r.len && r.buf[r.position] == ' ' {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tprev = c\n\t\tr.position++\n\t}\n\tr.position++\n\tif !done {\n\t\treturn errors.New(\"structured data must end with ']'\")\n\t}\n\treturn nil\n}\n\nfunc (r *RFC5424) parseMessage() error {\n\tif r.position == r.len {\n\t\treturn errors.New(\"message is empty\")\n\t}\n\n\tmessage := []byte{}\n\n\tfor r.position < r.len {\n\t\tc := r.buf[r.position]\n\t\tmessage = append(message, c)\n\t\tr.position++\n\t}\n\tr.Message = string(message)\n\treturn nil","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/syslog/internal/parser/rfc5424/parse.go#L256-L292","documentation":"Returned by parseStructuredData when the end of the buffer is reached without finding an unescaped ']' closing the STRUCTURED-DATA element — the SD token is truncated or its closing bracket is missing/escaped.","triggerScenarios":"Thrown at pkg/acquisition/modules/syslog/internal/parser/rfc5424/parse.go:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close every STRUCTURED-DATA element with an unescaped ']'","Escape ']' inside param values as '\\]' per RFC5424","Check the message wasn't truncated in transit before reaching the parser"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}