{"record":{"id":"da95d91cddc2ca66","repo":"pathwaycom/pathway","slug":"topic-name-must-not-be-empty","errorCode":null,"errorMessage":"Topic name must not be empty","messagePattern":"Topic name must not be empty","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/pulsar/__init__.py","lineNumber":358,"sourceCode":"\n    >>> class EventSchema(pw.Schema):\n    ...     event_id: str\n    ...     temperature: float\n    >>> events = pw.io.pulsar.read(\n    ...     \"pulsar://localhost:6650\",\n    ...     \"measurements\",\n    ...     format=\"json\",\n    ...     schema=EventSchema,\n    ... )\n    >>> deduplicated = events.groupby(events.event_id).reduce(\n    ...     events.event_id,\n    ...     temperature=pw.reducers.earliest(events.temperature),\n    ... )\n    \"\"\"\n    _check_entitlements(\"pulsar\")\n    _check_tls_settings(tls_settings)\n    if not topic:\n        raise ValueError(\"Topic name must not be empty\")\n\n    effective_timestamp = resolve_start_from_timestamp_ms(\n        start_from, start_from_timestamp_ms\n    )\n\n    data_storage = api.DataStorage(\n        storage_type=\"pulsar\",\n        path=uri,\n        topic=topic,\n        mode=internal_connector_mode(mode),\n        durable_consumer_name=subscription_name,\n        start_from_timestamp_ms=effective_timestamp,\n        tls_settings=tls_settings.settings if tls_settings is not None else None,\n        pulsar_settings=_construct_pulsar_settings(auth, subscription_type),\n    )\n    schema, data_format = construct_schema_and_data_format(\n        \"binary\" if format == \"raw\" else format,\n        schema=schema,","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/pulsar/__init__.py#L340-L376","documentation":"Raised by pw.io.pulsar.read when the topic argument is an empty string. An empty topic name is almost always a plumbing bug (unset env var, wrong variable), and letting it through would produce a confusing broker-side error, so Pathway rejects it during graph construction.","triggerScenarios":"Calling pw.io.pulsar.read(uri, topic='') or topic=os.environ.get('PULSAR_TOPIC') where the variable is unset/empty; computing the topic name from config that yields an empty string.","commonSituations":"Environment-driven configuration with a missing or misspelled variable; default topic parameters in shared helper functions that resolve to '' in some deployments; templated configs where the topic placeholder was never filled.","solutions":["Ensure topic is a non-empty string: check the env var name and provide a sensible default or fail fast at config load.","Centralize validation: raise before calling read if not topic.","If the topic is dynamic per environment, log the resolved value at startup to catch empty substitutions early."],"exampleFix":"# before\ntopic = os.environ.get(\"PULSAR_TOPIC\", \"\")\npw.io.pulsar.read(uri, topic, schema=S)\n\n# after\ntopic = os.environ.get(\"PULSAR_TOPIC\")\nif not topic:\n    raise RuntimeError(\"PULSAR_TOPIC must be set to a non-empty topic name\")\npw.io.pulsar.read(uri, topic, schema=S)","handlingStrategy":"validation","validationCode":"topic = os.environ[\"PULSAR_TOPIC\"]\nif not topic:\n    raise RuntimeError(\"PULSAR_TOPIC is empty\")\npw.io.pulsar.read(uri, topic, schema=S)","typeGuard":"def non_empty_topic(topic) -> bool:\n    return isinstance(topic, str) and bool(topic.strip())","tryCatchPattern":null,"preventionTips":["Fail fast on empty env vars at config load, not at connector setup.","Log resolved topic names at startup.","Use required env access (os.environ[...]) instead of .get(..., '')."],"tags":["pathway","pulsar","topic","configuration","env"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}