pathwaycom/pathway · error · ValueError

'publication_name' is required for the streaming mode

Error message

'publication_name' is required for the streaming mode

What it means

Raised by _construct_replication_settings when mode="streaming" but publication_name is None. Streaming mode consumes a PostgreSQL logical-replication publication, and Pathway deliberately requires the user to have created it (with a table list and REPLICA IDENTITY), so it cannot default one.

Source

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

    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"
        )

    return api.PsqlReplicationSettings(
        connection_string=(
            _replication_connection_string_from_settings(postgres_settings)
        ),
        publication_name=publication_name,
        snapshot_name=snapshot_name,
        replication_slot_name=replication_slot_name,
    )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Create a publication on the source DB: CREATE PUBLICATION mypub FOR TABLE mytable; and set table REPLICA IDENTITY appropriately.
  2. Pass publication_name="mypub" to the streaming read.
  3. If you did not want CDC, switch to mode="static".

Example fix

-- SQL
CREATE PUBLICATION pw_pub FOR TABLE orders;
# python, before
pw.io.postgres.read(parts, "orders", mode="streaming")
# after
pw.io.postgres.read(parts, "orders", mode="streaming", publication_name="pw_pub")
Defensive patterns

Strategy: validation

Validate before calling

if mode == "streaming":
    assert publication_name, "create a publication first: CREATE PUBLICATION ... FOR TABLE ..."

Prevention

When it happens

Trigger: pw.io.postgres.read(..., mode="streaming") with no publication_name; passing publication_name=None explicitly.

Common situations: First-time CDC users who assume Pathway creates all replication objects; migrations from other CDC tools that auto-create publications.

Related errors


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