BerriAI/litellm · error · NotImplementedError

Export format ' ' not supported. Use 'parquet' or 'csv'.

Error message

Export format '{self.export_format}' not supported. Use 'parquet' or 'csv'.

What it means

FocusExportEngine._init_serializer raises NotImplementedError when export_format is anything other than 'csv' or 'parquet'. The export engine serializes FOCUS billing data via a serializer chosen by exact string match, so unknown formats have no implementation to dispatch to. This fails during engine construction, before any data is read.

Solutions

  1. Set export_format to exactly 'parquet' or 'csv' (lowercase).
  2. If you need JSON, export CSV and convert downstream — the engine has no JSON serializer.
  3. Validate the value at config-load time so users get an error before the scheduler starts.
  4. Check for leading/trailing whitespace or case differences in the configured value.

Example fix

# before
engine = FocusExportEngine(export_format='json', ...)

# after
engine = FocusExportEngine(export_format='csv', ...)
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_FORMATS = {'csv', 'parquet'}
fmt = (export_format or '').strip().lower()
if fmt not in SUPPORTED_FORMATS:
    raise SystemExit(f'export_format must be one of {sorted(SUPPORTED_FORMATS)}, got {export_format!r}')

Type guard

def is_supported_export_format(fmt: str | None) -> bool:
    return fmt in {'csv', 'parquet'}

Try / catch

try:
    engine = FocusExportEngine(export_format=fmt, ...)
except NotImplementedError as e:
    raise ConfigError('FOCUS export_format must be csv or parquet') from e

Prevention

When it happens

Trigger: Passing export_format='json', 'JSON', 'PARQUET' (case matters), or a typo like 'cv' to the FOCUS export engine; loading export_format from a config field or env var with an unexpected value; a new config value shipped without updating the engine.

Common situations: Assuming JSON output is supported because other litellm export paths use it; case mismatches ('CSV' vs 'csv'); stale documentation or templates suggesting 'jsonl'; copy-pasting a format value from a different integration.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/c7e9af4be5d2eab0. Report an issue: GitHub.

Appendix: source

Thrown at litellm/integrations/focus/export_engine.py:45

    ) -> None:
        self.provider = provider
        self.export_format = export_format
        self.prefix = prefix
        self._destination = FocusDestinationFactory.create(
            provider=self.provider,
            prefix=self.prefix,
            config=destination_config,
        )
        self._serializer = self._init_serializer()
        self._transformer = FocusTransformer()
        self._database = FocusLiteLLMDatabase()

    def _init_serializer(self) -> FocusSerializer:
        if self.export_format == "csv":
            return FocusCsvSerializer()
        if self.export_format == "parquet":
            return FocusParquetSerializer()
        raise NotImplementedError(f"Export format '{self.export_format}' not supported. Use 'parquet' or 'csv'.")

    async def dry_run_export_usage_data(self, limit: int | None) -> dict[str, Any]:
        data: Final = await self._database.get_usage_data(limit=limit)
        normalized: Final = self._transformer.transform(data)

        usage_sample: Final = data.head(min(50, len(data))).to_dicts()
        normalized_sample: Final = normalized.head(min(50, len(normalized))).to_dicts()

        summary: Final = {
            "total_records": len(normalized),
            "total_spend": self._sum_column(data, "spend"),
            "total_tokens": self._sum_column(data, "total_tokens"),
            "unique_teams": self._count_unique(data, "team_id"),
            "unique_models": self._count_unique(data, "model"),
        }

        return {
            "usage_data": usage_sample,

View on GitHub (pinned to 77b7c6c40c)