JuliusBrussee/caveman · error
unknown import format
Error message
unknown import format %q: supported formats are otlp, caveman-jsonl, langfuse, helicone, generic
What it means
importers.Parse dispatches on the Options.Format value; the switch only accepts otlp, caveman-jsonl, langfuse, helicone, and generic. Any other format string hits the default branch and fails closed with this error rather than guessing or silently passing data through.
Solutions
- Use one of the exact lowercase format strings: otlp, caveman-jsonl, langfuse, helicone, generic
- Prefer the library's exported Format constants over hand-typed strings
- Normalize/validate user-supplied format input (lowercase, trim) before calling Parse
- Check the package for the current list of supported formats if upgrading between versions
Example fix
// before
importers.Parse(data, importers.Options{Format: "JSONL"})
// after
importers.Parse(data, importers.Options{Format: importers.FormatCavemanJSONL}) Defensive patterns
Strategy: validation
Validate before calling
var validFormats = map[string]bool{"otlp":true,"caveman-jsonl":true,"langfuse":true,"helicone":true,"generic":true}
if !validFormats[opts.Format] {
return fmt.Errorf("unsupported format %q", opts.Format)
} Try / catch
rows, err := importers.Parse(data, opts)
if err != nil {
if strings.Contains(err.Error(), "unknown import format") {
return fmt.Errorf("please pick one of: otlp, caveman-jsonl, langfuse, helicone, generic: %w", err)
}
return err
} Prevention
- Use the library's exported Format constants, never raw strings
- Normalize user input (lowercase, trim) before mapping to a format
- Validate CLI format flags against the supported list at startup
- Re-check format constants when upgrading the library
When it happens
Trigger: Calling Parse with a Format value that is misspelled ("jsonl", "OTLP", "langfuse-exports"), an empty string, or a format from a newer/older version of the library not in the supported set.
Common situations: Case mismatch (Format constants are lowercase); building the format from user CLI input without validation; version drift where a format constant was renamed; passing a file extension instead of a format name.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- aes cipher
- apiKey, baseURL, and agent are required
- ASGI context resolver or request bounds are invalid
- AutoGen tools and workbench are mutually exclusive
- awssig: signer requires region and service
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/50d41b65df003004.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/importers/importers.go:92
}
var (
rows []Span
err error
)
switch format {
case FormatOTLP:
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
}
// ---------------------------------------------------------------------------View on GitHub (pinned to 3ee70a1026)