{"record":{"id":"9bc5a3daf9051729","repo":"pathwaycom/pathway","slug":"either-none-or-both-of-replication-slot-name-s","errorCode":null,"errorMessage":"Either none or both of 'replication_slot_name', 'snapshot_name' must be specified","messagePattern":"Either none or both of 'replication_slot_name', 'snapshot_name' must be specified","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/postgres/__init__.py","lineNumber":273,"sourceCode":"    # static mode doesn't require replication slots\n    if mode == \"static\":\n        if publication_name is not None:\n            raise ValueError(\"'publication_name' is not needed for the static mode\")\n        if replication_slot_name is not None:\n            raise ValueError(\n                \"'replication_slot_name' is not needed for the static mode\"\n            )\n        if snapshot_name is not None:\n            raise ValueError(\"'snapshot_name' is not needed for the static mode\")\n        return None\n    if publication_name is None:\n        raise ValueError(\"'publication_name' is required for the streaming mode\")\n\n    # streaming mode: user provides publication, we create the slot\n    replication_slot_defined = replication_slot_name is None\n    snapshot_name_defined = snapshot_name is None\n    if replication_slot_defined != snapshot_name_defined:\n        raise ValueError(\n            \"Either none or both of 'replication_slot_name', 'snapshot_name' must be specified\"\n        )\n\n    return api.PsqlReplicationSettings(\n        connection_string=(\n            _replication_connection_string_from_settings(postgres_settings)\n        ),\n        publication_name=publication_name,\n        snapshot_name=snapshot_name,\n        replication_slot_name=replication_slot_name,\n    )\n\n\n@check_arg_types\n@trace_user_frame\ndef read(\n    postgres_settings: dict,\n    table_name: str,","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/postgres/__init__.py#L255-L291","documentation":"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).","triggerScenarios":"pw.io.postgres.read(..., mode=\"streaming\", publication_name=\"p\", replication_slot_name=\"s\") without snapshot_name, or snapshot_name only without replication_slot_name.","commonSituations":"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.","solutions":["To resume an existing slot: EXPORT SNAPSHOT via the slot's consistent point and pass both names together.","To let Pathway manage the slot: omit both arguments.","If you passed only snapshot_name by mistake, remove it."],"exampleFix":"# before\npw.io.postgres.read(parts, \"t\", mode=\"streaming\", publication_name=\"p\", replication_slot_name=\"pw_slot\")\n# after (Pathway-managed slot)\npw.io.postgres.read(parts, \"t\", mode=\"streaming\", publication_name=\"p\")\n# after (resume)\npw.io.postgres.read(parts, \"t\", mode=\"streaming\", publication_name=\"p\", replication_slot_name=\"pw_slot\", snapshot_name=\"snap\")","handlingStrategy":"validation","validationCode":"if mode == \"streaming\":\n    assert (replication_slot_name is None) == (snapshot_name is None), \"pass both slot+snapshot or neither\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat replication_slot_name and snapshot_name as an all-or-nothing resume pair.","Persist both values together (e.g. one state file) when exporting them for a restart."],"tags":["postgres","cdc","replication","argument-pairing"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}