pathwaycom/pathway · error · ValueError

Unknown format: {}. Only {} are supported

Error message

Unknown format: {}. Only {} are supported

What it means

Raised by the Pathway filesystem output connector (pw.io.fs.write and CSV/JSON writers built on it) when the `format` argument is not one of SUPPORTED_OUTPUT_FORMATS (csv, json). The connector only knows how to serialize rows into those two formats.

Source

Thrown at python/pathway/io/fs/__init__.py:353

    Then, we can also check the output file by executing the command:

    .. code-block:: bash

        cat table.jsonlines

    .. code-block:: json

        {"age":10,"owner":"Alice","pet":"dog","diff":1,"time":0}
        {"age":9,"owner":"Bob","pet":"cat","diff":1,"time":0}
        {"age":8,"owner":"Alice","pet":"cat","diff":1,"time":0}

    As one can easily see, the values remain the same, while the format has changed to
    a plain JSON.
    """

    if format not in SUPPORTED_OUTPUT_FORMATS:
        raise ValueError(
            "Unknown format: {}. Only {} are supported".format(
                format, ", ".join(SUPPORTED_OUTPUT_FORMATS)
            )
        )

    data_storage = api.DataStorage(storage_type="fs", path=fspath(filename))
    if format == "csv":
        data_format = api.DataFormat(
            format_type="dsv",
            key_field_names=[],
            value_fields=_format_output_value_fields(table),
            delimiter=",",
        )
    elif format == "json":
        data_format = api.DataFormat(
            format_type="jsonlines",
            key_field_names=[],
            value_fields=_format_output_value_fields(table),

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Use format="json" for newline-delimited JSON output — it already emits one object per line.
  2. Use format="csv" for comma-separated output (see the delimiter options of pw.io.csv.write).
  3. For parquet or other formats, write to a format pathway supports and convert afterwards, or use a different pathway connector that supports your target.

Example fix

# before
pw.io.fs.write(t, filename="out.parquet", format="parquet")

# after
pw.io.fs.write(t, filename="out.json", format="json")
Defensive patterns

Strategy: validation

Validate before calling

from pathway.io.fs import SUPPORTED_OUTPUT_FORMATS
assert format in SUPPORTED_OUTPUT_FORMATS, (
    f"format must be one of {sorted(SUPPORTED_OUTPUT_FORMATS)}"
)

Type guard

def is_supported_fs_format(fmt: str) -> bool:
    from pathway.io.fs import SUPPORTED_OUTPUT_FORMATS
    return fmt in SUPPORTED_OUTPUT_FORMATS

Prevention

When it happens

Trigger: pw.io.fs.write(t, filename="out", format="parquet") or format="jsonl" — any string other than exactly "csv" or "json".

Common situations: Assuming parquet/avro/orc support because other connectors have it; passing "jsonl"/"ndjson" for newline-delimited JSON (pathway's "json" format already writes one JSON object per line); typos like "CSV" with uppercase.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/3143e00a7e0a09c8. Report an issue: GitHub.