pathwaycom/pathway · error · ValueError

Either none or both of 'replication_slot_name', 'snapshot_na

Error message

Either none or both of 'replication_slot_name', 'snapshot_name' must be specified

What it means

Raised by _construct_replication_settings in streaming mode when exactly one of replication_slot_name and snapshot_name is provided. These two arguments form a pair used to resume an existing replication setup; supplying only one is ambiguous, so Pathway demands both or neither (in which case it creates the slot itself).

Source

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

    # 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,
    )


@check_arg_types
@trace_user_frame
def read(
    postgres_settings: dict,
    table_name: str,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. To resume an existing slot: EXPORT SNAPSHOT via the slot's consistent point and pass both names together.
  2. To let Pathway manage the slot: omit both arguments.
  3. If you passed only snapshot_name by mistake, remove it.

Example fix

# before
pw.io.postgres.read(parts, "t", mode="streaming", publication_name="p", replication_slot_name="pw_slot")
# after (Pathway-managed slot)
pw.io.postgres.read(parts, "t", mode="streaming", publication_name="p")
# after (resume)
pw.io.postgres.read(parts, "t", mode="streaming", publication_name="p", replication_slot_name="pw_slot", snapshot_name="snap")
Defensive patterns

Strategy: validation

Validate before calling

if mode == "streaming":
    assert (replication_slot_name is None) == (snapshot_name is None), "pass both slot+snapshot or neither"

Prevention

When it happens

Trigger: pw.io.postgres.read(..., mode="streaming", publication_name="p", replication_slot_name="s") without snapshot_name, or snapshot_name only without replication_slot_name.

Common situations: Users resuming after a restart who remember the slot name but not the snapshot export; partial copy-paste of resume parameters from docs or a previous run's logs.

Related errors


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