JuliusBrussee/caveman · error
sanitize row : events exceed bytes
Error message
sanitize row %d: events exceed %d bytes
What it means
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.
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
Example fix
// before: events payload 2MB, limit 128KB
span.EventsJSON = string(bigPayload)
// after: truncate before import
if len(bigPayload) > limit { bigPayload = bigPayload[:limit] }
span.EventsJSON = string(bigPayload) Defensive patterns
Strategy: validation
Validate before calling
const maxEvents = telemetry.MaxEventsBytes
for i, row := range rows {
if len(row.EventsJSON) > maxEvents {
return fmt.Errorf("row %d events too large (%d > %d bytes)", i, len(row.EventsJSON), maxEvents)
}
} Try / catch
rows, err := importers.Parse(data, opts)
if err != nil {
if strings.Contains(err.Error(), "events exceed") {
return fmt.Errorf("truncate or split oversized event payloads and retry import: %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: A parsed span carries EventsJSON larger than telemetry.MaxEventsBytes — typically from imports containing very large tool outputs, embedded blobs, or verbose LLM event payloads.
Common situations: 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.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- bounded
- cave_budget_release_exceeds_max
- cave_sandbox_input_limit
- clickhouse response exceeds
- eval evidence batch exceeds 1000 records
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/43ca00ea02f1b9a4.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/importers/importers.go:99
rows, err = parseOTLP(data, opts)
case FormatCavemanJSONL:
rows, err = parseCavemanJSONL(data, opts)
case FormatLangfuse:
rows, err = parseLangfuse(data, opts)
case FormatHelicone:
rows, err = parseHelicone(data, opts)
case FormatGeneric:
rows, err = parseGeneric(data, opts)
default:
// fail-closed: unknown formats are an error, never a silent pass-through.
return nil, Summary{}, fmt.Errorf("unknown import format %q: supported formats are otlp, caveman-jsonl, langfuse, helicone, generic", format)
}
if err != nil {
return nil, Summary{}, err
}
for i := range rows {
if len(rows[i].EventsJSON) > telemetry.MaxEventsBytes {
return nil, Summary{}, fmt.Errorf("sanitize row %d: events exceed %d bytes", i, telemetry.MaxEventsBytes)
}
sanitized, sanitizeErr := telemetry.SanitizeAttributes(rows[i].Attributes)
if sanitizeErr != nil {
return nil, Summary{}, fmt.Errorf("sanitize row %d: %w", i, sanitizeErr)
}
rows[i].Attributes = sanitized
}
return rows, Summary{Format: format, RowCount: len(rows)}, nil
}
// ---------------------------------------------------------------------------
// Shared helpers
// ---------------------------------------------------------------------------
// chTimeLayout is the ClickHouse DateTime64 textual layout the gateway writer
// uses; importers must produce the same shape ("2006-01-02 15:04:05.000").
const chTimeLayout = "2006-01-02 15:04:05.000"
View on GitHub (pinned to 3ee70a1026)