{"record":{"id":"875bfd77eb3cd859","repo":"pathwaycom/pathway","slug":"missing-topic-name-specification","errorCode":null,"errorMessage":"Missing topic name specification","messagePattern":"Missing topic name specification","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/kafka/__init__.py","lineNumber":325,"sourceCode":"            f\"to the start of the partition. Your value \"\n            f\"{user_offset_reset!r} is being ignored.\",\n            stacklevel=_stacklevel + 4,\n        )\n\n    # Distinguish \"missing topic\" from \"explicitly empty topic\" — the former\n    # is a user typo (rename to 'topic='), the latter is an invalid value\n    # that Kafka itself would reject with a less actionable error.\n    if topic is None:\n        if \"topic_name\" in kwargs:\n            raise TypeError(\n                \"Got unexpected keyword argument 'topic_name'. \"\n                \"pw.io.kafka.read uses 'topic' (the corresponding parameter \"\n                \"in pw.io.kafka.write is 'topic_name'). Please rename \"\n                \"'topic_name=' to 'topic='.\"\n            )\n        topic_names = kwargs.pop(\"topic_names\", None)\n        if not topic_names:\n            raise ValueError(\"Missing topic name specification\")\n        if isinstance(topic_names, str):\n            warnings.warn(\n                \"'topic_names' is deprecated; please use 'topic' instead.\",\n                DeprecationWarning,\n                stacklevel=_stacklevel + 4,\n            )\n            topic = topic_names\n        elif isinstance(topic_names, (list, tuple)):\n            warnings.warn(\n                \"'topic_names' is deprecated; please use 'topic' instead. \"\n                \"Only the first element of the provided list is used as \"\n                \"the topic name.\",\n                DeprecationWarning,\n                stacklevel=_stacklevel + 4,\n            )\n            topic = topic_names[0]\n        else:\n            raise TypeError(","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/kafka/__init__.py#L307-L343","documentation":"pw.io.kafka.read needs to know which Kafka topic to subscribe to. When 'topic' is not supplied positionally or by keyword, and no deprecated 'topic_names' alias is found in kwargs, the connector raises ValueError('Missing topic name specification') rather than letting a topic-less consumer silently read nothing.","triggerScenarios":"pw.io.kafka.read(rdkafka_settings) with no topic argument; passing the topic inside the rdkafka_settings dict (where it is ignored); passing topic=None explicitly with no alias.","commonSituations":"Assuming the topic can live inside rdkafka_settings like other librdkafka options; a refactoring that drops the topic argument; passing an empty string topic is a different error — this one is strictly for no specification at all.","solutions":["Pass the topic explicitly: pw.io.kafka.read(rdkafka_settings, topic='test-topic').","Do not embed the topic in rdkafka_settings — Pathway reads it only from the dedicated argument.","The deprecated topic_names=... alias still works (with a DeprecationWarning) but should be migrated to topic=."],"exampleFix":"# before\nt = pw.io.kafka.read(rdkafka_settings)\n# after\nt = pw.io.kafka.read(rdkafka_settings, topic=\"test-topic\")","handlingStrategy":"validation","validationCode":"if not topic and not topic_names:\n    raise SystemExit(\"Kafka topic is required; set it via topic=...\")\n\nt = pw.io.kafka.read(rdkafka_settings, topic=topic, **({\"topic_names\": topic_names} if topic_names else {}))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass topic as an explicit argument; never rely on rdkafka_settings to carry it.","Centralize connector construction in one function per app so the topic argument cannot be forgotten."],"tags":["kafka","api-misuse","configuration","pathway"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}