{"record":{"id":"50d41b65df003004","repo":"JuliusBrussee/caveman","slug":"unknown-import-format-q-supported-formats-are-ot","errorCode":null,"errorMessage":"unknown import format %q: supported formats are otlp, caveman-jsonl, langfuse, helicone, generic","messagePattern":"unknown import format %q: supported formats are otlp, caveman-jsonl, langfuse, helicone, generic","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/importers/importers.go","lineNumber":92,"sourceCode":"\t}\n\tvar (\n\t\trows []Span\n\t\terr  error\n\t)\n\tswitch format {\n\tcase FormatOTLP:\n\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// ---------------------------------------------------------------------------","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/importers/importers.go#L74-L110","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nimporters.Parse(data, importers.Options{Format: \"JSONL\"})\n// after\nimporters.Parse(data, importers.Options{Format: importers.FormatCavemanJSONL})","handlingStrategy":"validation","validationCode":"var validFormats = map[string]bool{\"otlp\":true,\"caveman-jsonl\":true,\"langfuse\":true,\"helicone\":true,\"generic\":true}\nif !validFormats[opts.Format] {\n  return fmt.Errorf(\"unsupported format %q\", opts.Format)\n}","typeGuard":null,"tryCatchPattern":"rows, err := importers.Parse(data, opts)\nif err != nil {\n  if strings.Contains(err.Error(), \"unknown import format\") {\n    return fmt.Errorf(\"please pick one of: otlp, caveman-jsonl, langfuse, helicone, generic: %w\", err)\n  }\n  return err\n}","preventionTips":["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"],"tags":["import","configuration","invalid-argument"],"backgroundTag":"invalid-enum-value","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"}