pathwaycom/pathway · error · ValueError
'subject' must be a non-empty string; got an empty string. S
Error message
'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.
What it means
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.
Source
Thrown at python/pathway/io/_utils.py:472
f"'delimiter' is only meaningful for the 'dsv' format, but "
f"{format!r} was specified. Drop the 'delimiter' argument "
f"or use format='dsv'."
)
if subject is not None and schema_registry_settings is None:
raise ValueError(
"'subject' was provided without 'schema_registry_settings'. "
"The 'subject' parameter only has an effect when a schema "
"registry is configured; either pass 'schema_registry_settings' "
"or remove 'subject'."
)
if schema_registry_settings is not None and subject is None:
raise ValueError(
"'schema_registry_settings' was provided without 'subject'. "
"When a schema registry is configured, 'subject' must also be "
"set so the formatter knows which subject to encode under."
)
if subject is not None and not subject:
raise ValueError(
"'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."
)
if schema_registry_settings is not None and format != "json":
raise ValueError(
f"'schema_registry_settings' is only meaningful for the 'json' "
f"format, but {format!r} was specified. The Confluent Schema "
"Registry currently encodes JSON payloads only; remove "
"'schema_registry_settings' or use format='json'."
)
key_field_index = None
header_fields: dict[str, int] = {}
extracted_field_indices: dict[str, int] = {}
columns_to_extract: list[ColumnReference] = []
if topic_name is not None:View on GitHub (pinned to fa2f74a464)
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.
Example fix
# before
subject = os.environ.get('KAFKA_SUBJECT', '') # may be ''
# after
subject = os.environ['KAFKA_SUBJECT'] # raises if unset, never '' Defensive patterns
Strategy: validation
Validate before calling
subject = os.environ.get('KAFKA_SUBJECT') or f'{topic}-value'
assert subject != '', 'subject must be a non-empty string' Type guard
def is_valid_subject(subject: str | None) -> bool:
return subject is None or (isinstance(subject, str) and subject != '') Prevention
- Never default env-driven subject to ''; fail fast on missing config.
- Validate config values (non-empty strings) once at startup before building connectors.
When it happens
Trigger: 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.
Common situations: Environment-driven configs where a missing variable silently becomes ''; templated subject strings with a blank component.
Related errors
- Failed to install dependencies
- Column {api.TIME_PSEUDOCOLUMN} cannot contain negative times
- SchemaRegistrySettings.urls[{i}] must be a non-empty string;
- 'subject' was provided without 'schema_registry_settings'. T
- 'schema_registry_settings' was provided without 'subject'. W
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/28ab15f1d7473eaa.
Report an issue: GitHub.