pathwaycom/pathway · error · TypeError

'simple_read' does not accept {forbidden!r}. If you need to

Error message

'simple_read' does not accept {forbidden!r}. If you need to customize the rdkafka settings (auth, TLS, consumer group, etc.) use 'pw.io.kafka.read' directly; 'simple_read' is a thin wrapper that builds these settings itself.

What it means

pw.io.kafka.simple_read is a thin convenience wrapper that builds the rdkafka settings itself from a server address and random group id. It therefore rejects the 'rdkafka_settings' (and internal '_stacklevel') keyword: passing it would silently override the wrapper's own settings construction.

Source

Thrown at python/pathway/io/kafka/__init__.py:493

    table: the message key is saved in a column named ``key`` and the message payload
    in a column named ``data``.

    For the "json" format, a ``schema`` is required and its columns define the table.

    Example:

    Consider that there's a Kafka queue running locally on the port 9092 and we need
    to read raw messages from the topic "test-topic". Then, it can be done in the
    following way:

    >>> import pathway as pw
    >>> t = pw.io.kafka.simple_read("localhost:9092", "test-topic")
    """

    forbidden_kwargs = ("rdkafka_settings", "_stacklevel")
    for forbidden in forbidden_kwargs:
        if forbidden in kwargs:
            raise TypeError(
                f"'simple_read' does not accept {forbidden!r}. "
                "If you need to customize the rdkafka settings (auth, TLS, "
                "consumer group, etc.) use 'pw.io.kafka.read' directly; "
                "'simple_read' is a thin wrapper that builds these settings "
                "itself."
            )

    if read_only_new and kwargs.get("mode") == "static":
        raise ValueError(
            "'read_only_new=True' together with mode='static' is "
            "self-contradictory: 'read_only_new' starts the consumer at the "
            "end of the partition, so the static reader has nothing to "
            "consume. Pick one — drop 'read_only_new=True' or use "
            "'mode=\"streaming\"' (the default)."
        )
    if read_only_new and kwargs.get("start_from_timestamp_ms") is not None:
        raise ValueError(
            "'read_only_new=True' and 'start_from_timestamp_ms' both control "

View on GitHub (pinned to fa2f74a464)

Solutions

  1. If you need custom settings (auth, TLS, consumer group, offset reset), switch to pw.io.kafka.read with a full rdkafka_settings dict.
  2. Otherwise drop the rdkafka_settings argument and let simple_read configure itself.

Example fix

# before
rdkafka_settings = {"bootstrap.servers": "localhost:9092", "group.id": "g", "sasl.mechanisms": "PLAIN"}
t = pw.io.kafka.simple_read(rdkafka_settings=rdkafka_settings, topic="t")
# after
t = pw.io.kafka.read(rdkafka_settings, topic="t")
Defensive patterns

Strategy: type-guard

Validate before calling

SIMPLE_READ_FORBIDDEN = {"rdkafka_settings", "_stacklevel"}
bad = SIMPLE_READ_FORBIDDEN & set(kwargs)
if bad:
    raise SystemExit(f"simple_read cannot take {bad}; use pw.io.kafka.read")

t = pw.io.kafka.simple_read("localhost:9092", "test-topic", **kwargs)

Type guard

def simple_read_safe(kwargs: dict) -> bool:
    return not ({"rdkafka_settings", "_stacklevel"} & set(kwargs))

Prevention

When it happens

Trigger: pw.io.kafka.simple_read('localhost:9092', 'test-topic', rdkafka_settings={...}) or forwarding a **kwargs dict that contains rdkafka_settings into simple_read.

Common situations: Starting from a simple_read example and then trying to add SASL/TLS/group-id configuration by passing rdkafka_settings; writing a generic wrapper that forwards the same options to both read and simple_read.

Understand the failure class

Related errors


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