pathwaycom/pathway · error · ValueError

'publication_name' is not needed for the static mode

Error message

'publication_name' is not needed for the static mode

What it means

Raised by _construct_replication_settings in the postgres connector when mode="static" (a one-shot snapshot read) is combined with a non-None publication_name. Publications are a logical-replication concept used only by streaming mode; in static mode Pathway reads data directly and never consumes a publication.

Source

Thrown at python/pathway/io/postgres/__init__.py:258

            raise ValueError("sslrootcert points to a non-existent path") from e
        except OSError as e:
            raise ValueError(f"sslrootcert is not readable: {e}") from e

    return TLSSettings(mode=sslmode, root_cert_path=sslrootcert)


def _construct_replication_settings(
    *,
    mode: Literal["streaming", "static"],
    postgres_settings: dict,
    publication_name: str | None,
    replication_slot_name: str | None,
    snapshot_name: str | None,
):
    # static mode doesn't require replication slots
    if mode == "static":
        if publication_name is not None:
            raise ValueError("'publication_name' is not needed for the static mode")
        if replication_slot_name is not None:
            raise ValueError(
                "'replication_slot_name' is not needed for the static mode"
            )
        if snapshot_name is not None:
            raise ValueError("'snapshot_name' is not needed for the static mode")
        return None
    if publication_name is None:
        raise ValueError("'publication_name' is required for the streaming mode")

    # streaming mode: user provides publication, we create the slot
    replication_slot_defined = replication_slot_name is None
    snapshot_name_defined = snapshot_name is None
    if replication_slot_defined != snapshot_name_defined:
        raise ValueError(
            "Either none or both of 'replication_slot_name', 'snapshot_name' must be specified"
        )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Remove publication_name from the static-mode read call.
  2. Also remove replication_slot_name and snapshot_name if present (they raise sibling errors).
  3. Keep the publication arguments only in the streaming call.

Example fix

# before
pw.io.postgres.read(parts, "tbl", mode="static", publication_name="mypub")
# after
pw.io.postgres.read(parts, "tbl", mode="static")
Defensive patterns

Strategy: validation

Validate before calling

if mode == "static":
    for k in ("publication_name", "replication_slot_name", "snapshot_name"):
        kwargs.pop(k, None)  # strip streaming-only args

Prevention

When it happens

Trigger: pw.io.postgres.read(..., mode="static", publication_name="pub") — note the arguments are accepted but rejected as contradictory.

Common situations: Switching a pipeline from streaming to static (e.g. for backfill or tests) and leaving the streaming publication/slot arguments in place; copy-pasting a read() call and changing only mode.

Related errors


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