pathwaycom/pathway · error · ValueError
'read_only_new=True' together with mode='static' is self-con
Error message
'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).
What it means
In pw.io.kafka.simple_read, read_only_new=True sets auto.offset.reset='end' so the consumer starts at the newest messages, while mode='static' reads only what exists at snapshot time. The combination would find nothing to consume, so Pathway rejects it as self-contradictory with an explicit ValueError.
Source
Thrown at python/pathway/io/kafka/__init__.py:502
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 "
"the starting position and conflict. Pick one — drop "
"'read_only_new=True' if you want to start from the timestamp, "
"or drop 'start_from_timestamp_ms' if you want to start from "
"the end."
)
rdkafka_settings = {
"bootstrap.servers": server,
"group.id": str(uuid.uuid4()),View on GitHub (pinned to fa2f74a464)
Solutions
- Drop read_only_new=True if you want a static snapshot-style read from the beginning.
- Or switch to mode='streaming' (the default) if you want to process only newly arriving messages.
- Remember static mode implies a bounded read; streaming mode with read_only_new gives a live tail of the topic.
Example fix
# before
t = pw.io.kafka.simple_read("localhost:9092", "test-topic", read_only_new=True, mode="static")
# after
t = pw.io.kafka.simple_read("localhost:9092", "test-topic", read_only_new=True) # mode="streaming" default Defensive patterns
Strategy: validation
Validate before calling
if read_only_new and mode == "static":
raise SystemExit(
"read_only_new=True needs streaming mode; drop it or use mode='streaming'"
)
t = pw.io.kafka.simple_read("localhost:9092", "test-topic", read_only_new=read_only_new, mode=mode) Type guard
def compatible_simple_read_opts(read_only_new: bool, mode: str) -> bool:
return not (read_only_new and mode == "static") Prevention
- Keep mode explicit in config files so flag conflicts are visible.
- Remember read_only_new maps to auto.offset.reset='end' — meaningless for bounded static reads.
When it happens
Trigger: pw.io.kafka.simple_read('localhost:9092', 'test-topic', read_only_new=True, mode='static'). The default mode is 'streaming', where read_only_new is valid.
Common situations: Adding read_only_new=True to an existing static-mode pipeline expecting 'only new data going forward'; copy-pasting flags between examples without reconciling mode semantics.
Related errors
- Got unexpected keyword argument 'topic_name'. pw.io.kafka.re
- Missing topic name specification
- 'topic_names' must be a str or a list of str; got {type(topi
- 'topic' must be a non-empty string; got an empty list. Kafka
- 'simple_read' does not accept {forbidden!r}. If you need to
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/a38f6d2970340f37.
Report an issue: GitHub.