pathwaycom/pathway · error · ValueError

'schema_registry_settings' was provided without 'subject'. W

Error message

'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.

What it means

Raised by MessageQueueOutputFormat.build when schema_registry_settings is provided without 'subject'. When encoding through the Confluent Schema Registry, the writer must know which subject to register/look up the schema under; registry settings alone are incomplete configuration, so Pathway requires the pair.

Source

Thrown at python/pathway/io/_utils.py:466

        subject: str | None = None,
        allowed_key_types: tuple[dt.DType, ...] | None = (dt.BYTES, dt.STR, dt.ANY),
        allowed_value_types: tuple[dt.DType, ...] | None = (dt.BYTES, dt.STR, dt.ANY),
    ) -> MessageQueueOutputFormat:
        if delimiter != "," and format != "dsv":
            raise ValueError(
                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'."
            )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Add the matching subject, e.g. subject='my-topic-value' (Confluent convention: <topic>-value for message values).
  2. If the registry is not actually wanted, remove schema_registry_settings entirely.

Example fix

# before
pw.io.kafka.write(t, ...,
    schema_registry_settings=pw.io.kafka.SchemaRegistrySettings(url=REGISTRY_URL))

# after
pw.io.kafka.write(t, ...,
    schema_registry_settings=pw.io.kafka.SchemaRegistrySettings(url=REGISTRY_URL),
    subject='my-topic-value')
Defensive patterns

Strategy: validation

Validate before calling

if schema_registry_settings is not None:
    assert subject, "schema_registry_settings requires a non-empty subject"

Try / catch

try:
    pw.io.kafka.write(t, ..., schema_registry_settings=settings)
except ValueError as e:
    if "without 'subject'" in str(e):
        pw.io.kafka.write(t, ..., schema_registry_settings=settings, subject=f'{topic}-value')
    else:
        raise

Prevention

When it happens

Trigger: pw.io.kafka.write(table, ..., schema_registry_settings=settings) with no subject; enabling registry settings copied from the read side (where no subject is needed) on the write side.

Common situations: Asymmetric configs: reading with a registry needs no subject, writing does; partial migration of an existing writer to schema-registry mode.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/836ed05e1108a323. Report an issue: GitHub.