{"record":{"id":"43ca00ea02f1b9a4","repo":"JuliusBrussee/caveman","slug":"sanitize-row-d-events-exceed-d-bytes","errorCode":null,"errorMessage":"sanitize row %d: events exceed %d bytes","messagePattern":"sanitize row (.+?): events exceed (.+?) bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/importers/importers.go","lineNumber":99,"sourceCode":"\t\trows, err = parseOTLP(data, opts)\n\tcase FormatCavemanJSONL:\n\t\trows, err = parseCavemanJSONL(data, opts)\n\tcase FormatLangfuse:\n\t\trows, err = parseLangfuse(data, opts)\n\tcase FormatHelicone:\n\t\trows, err = parseHelicone(data, opts)\n\tcase FormatGeneric:\n\t\trows, err = parseGeneric(data, opts)\n\tdefault:\n\t\t// fail-closed: unknown formats are an error, never a silent pass-through.\n\t\treturn nil, Summary{}, fmt.Errorf(\"unknown import format %q: supported formats are otlp, caveman-jsonl, langfuse, helicone, generic\", format)\n\t}\n\tif err != nil {\n\t\treturn nil, Summary{}, err\n\t}\n\tfor i := range rows {\n\t\tif len(rows[i].EventsJSON) > telemetry.MaxEventsBytes {\n\t\t\treturn nil, Summary{}, fmt.Errorf(\"sanitize row %d: events exceed %d bytes\", i, telemetry.MaxEventsBytes)\n\t\t}\n\t\tsanitized, sanitizeErr := telemetry.SanitizeAttributes(rows[i].Attributes)\n\t\tif sanitizeErr != nil {\n\t\t\treturn nil, Summary{}, fmt.Errorf(\"sanitize row %d: %w\", i, sanitizeErr)\n\t\t}\n\t\trows[i].Attributes = sanitized\n\t}\n\treturn rows, Summary{Format: format, RowCount: len(rows)}, nil\n}\n\n// ---------------------------------------------------------------------------\n// Shared helpers\n// ---------------------------------------------------------------------------\n\n// chTimeLayout is the ClickHouse DateTime64 textual layout the gateway writer\n// uses; importers must produce the same shape (\"2006-01-02 15:04:05.000\").\nconst chTimeLayout = \"2006-01-02 15:04:05.000\"\n","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/importers/importers.go#L81-L117","documentation":"After parsing, Parse sanitizes each row; if a row's EventsJSON exceeds telemetry.MaxEventsBytes, the import aborts with this error naming the row index and the byte limit. This caps oversized event payloads so a single huge span cannot bloat storage or memory.","triggerScenarios":"A parsed span carries EventsJSON larger than telemetry.MaxEventsBytes — typically from imports containing very large tool outputs, embedded blobs, or verbose LLM event payloads.","commonSituations":"Importing traces that captured full request/response bodies in events; OTLP exporters with unlimited event sizes; benchmark fixtures with dumped payloads; a lowered MaxEventsBytes configuration after upgrading.","solutions":["Trim or truncate large events in the source data so each row's EventsJSON fits under telemetry.MaxEventsBytes","Split oversized spans into smaller spans/events before import","Check the current MaxEventsBytes limit and whether raising it is appropriate for your deployment","Strip verbose event payloads (bodies, blobs) at export time"],"exampleFix":"// before: events payload 2MB, limit 128KB\nspan.EventsJSON = string(bigPayload)\n// after: truncate before import\nif len(bigPayload) > limit { bigPayload = bigPayload[:limit] }\nspan.EventsJSON = string(bigPayload)","handlingStrategy":"validation","validationCode":"const maxEvents = telemetry.MaxEventsBytes\nfor i, row := range rows {\n  if len(row.EventsJSON) > maxEvents {\n    return fmt.Errorf(\"row %d events too large (%d > %d bytes)\", i, len(row.EventsJSON), maxEvents)\n  }\n}","typeGuard":null,"tryCatchPattern":"rows, err := importers.Parse(data, opts)\nif err != nil {\n  if strings.Contains(err.Error(), \"events exceed\") {\n    return fmt.Errorf(\"truncate or split oversized event payloads and retry import: %w\", err)\n  }\n  return err\n}","preventionTips":["Truncate event payloads at export/capture time","Avoid embedding full request/response bodies in span events","Know the MaxEventsBytes limit for your deployment","Split very large traces into smaller spans before import"],"tags":["import","limits","payload"],"backgroundTag":"payload-too-large","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}