{"record":{"id":"28ab15f1d7473eaa","repo":"pathwaycom/pathway","slug":"subject-must-be-a-non-empty-string-got-an-empty","errorCode":null,"errorMessage":"'subject' must be a non-empty string; got an empty string. Schema Registry subjects identify a named schema version, and an empty subject is never a valid registry entry.","messagePattern":"'subject' must be a non-empty string; got an empty string\\. Schema Registry subjects identify a named schema version, and an empty subject is never a valid registry entry\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/_utils.py","lineNumber":472,"sourceCode":"                f\"'delimiter' is only meaningful for the 'dsv' format, but \"\n                f\"{format!r} was specified. Drop the 'delimiter' argument \"\n                f\"or use format='dsv'.\"\n            )\n        if subject is not None and schema_registry_settings is None:\n            raise ValueError(\n                \"'subject' was provided without 'schema_registry_settings'. \"\n                \"The 'subject' parameter only has an effect when a schema \"\n                \"registry is configured; either pass 'schema_registry_settings' \"\n                \"or remove 'subject'.\"\n            )\n        if schema_registry_settings is not None and subject is None:\n            raise ValueError(\n                \"'schema_registry_settings' was provided without 'subject'. \"\n                \"When a schema registry is configured, 'subject' must also be \"\n                \"set so the formatter knows which subject to encode under.\"\n            )\n        if subject is not None and not subject:\n            raise ValueError(\n                \"'subject' must be a non-empty string; got an empty string. \"\n                \"Schema Registry subjects identify a named schema version, \"\n                \"and an empty subject is never a valid registry entry.\"\n            )\n        if schema_registry_settings is not None and format != \"json\":\n            raise ValueError(\n                f\"'schema_registry_settings' is only meaningful for the 'json' \"\n                f\"format, but {format!r} was specified. The Confluent Schema \"\n                \"Registry currently encodes JSON payloads only; remove \"\n                \"'schema_registry_settings' or use format='json'.\"\n            )\n\n        key_field_index = None\n        header_fields: dict[str, int] = {}\n        extracted_field_indices: dict[str, int] = {}\n        columns_to_extract: list[ColumnReference] = []\n\n        if topic_name is not None:","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/_utils.py#L454-L490","documentation":"Raised by MessageQueueOutputFormat.build when subject is not None but is the empty string. Schema Registry subjects name a schema version (e.g. 'orders-value'); an empty string is never a valid registry entry and would fail confusingly at write time, so it is rejected at build time. Note the check ordering: subject='' also passes the 'not None' checks, and this guard catches it.","triggerScenarios":"subject=os.environ.get('KAFKA_SUBJECT', '') when the env var is unset; subject generated by string concatenation where the topic-name part is empty; config loaded from YAML with an empty subject value.","commonSituations":"Environment-driven configs where a missing variable silently becomes ''; templated subject strings with a blank component.","solutions":["Set subject to a real registry subject name such as '<topic>-value'.","If the value comes from config/env, fail loudly when it is empty instead of defaulting to ''.","Re-check the pairing rules: subject must be non-empty and accompanied by schema_registry_settings."],"exampleFix":"# before\nsubject = os.environ.get('KAFKA_SUBJECT', '')  # may be ''\n\n# after\nsubject = os.environ['KAFKA_SUBJECT']  # raises if unset, never ''","handlingStrategy":"validation","validationCode":"subject = os.environ.get('KAFKA_SUBJECT') or f'{topic}-value'\nassert subject != '', 'subject must be a non-empty string'","typeGuard":"def is_valid_subject(subject: str | None) -> bool:\n    return subject is None or (isinstance(subject, str) and subject != '')","tryCatchPattern":null,"preventionTips":["Never default env-driven subject to ''; fail fast on missing config.","Validate config values (non-empty strings) once at startup before building connectors."],"tags":["pathway","kafka","schema-registry","configuration","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}