pathwaycom/pathway · error · TypeError

SchemaRegistryHeader.value must be a str, got {type(self.val

Error message

SchemaRegistryHeader.value must be a str, got {type(self.value).__name__}.

What it means

pw.io.deltalake.read can reconstruct the original Pathway schema only because pw.io.deltalake.write stores per-column dtype metadata under a Pathway-specific field in the Delta table's field metadata. If none of the Delta columns carry that marker, the table was not written by Pathway and the schema cannot be recovered.

Source

Thrown at python/pathway/internals/_io_helpers.py:238

    Args:
        key: The header key.
        value: The header value.

    Returns:
        The constructed header object
    """

    key: str
    value: str

    def __post_init__(self):
        if not isinstance(self.key, str):
            raise TypeError(
                f"SchemaRegistryHeader.key must be a str, got "
                f"{type(self.key).__name__}."
            )
        if not isinstance(self.value, str):
            raise TypeError(
                f"SchemaRegistryHeader.value must be a str, got "
                f"{type(self.value).__name__}."
            )


@dataclasses.dataclass(frozen=True)
class SchemaRegistrySettings:
    """
    Connection settings for the Confluent Schema Registry.

    Args:
        urls: A list of URLs for connecting to the schema registry. If multiple URLs
            are provided, they will be used in the specified order.
        token_authorization: Token used for token-based authorization.
        username: Username for simple authorization.
        password: Password for simple authorization. If specified, a username
            must also be provided.
        headers: Additional headers to include in HTTP requests to the schema registry.

View on GitHub (pinned to fa2f74a464)

Solutions

  1. If you only need the raw values, read with the generic connector and cast afterwards (e.g. pw.io.deltalake.read with an explicit schema or the raw-data path supported by your version).
  2. Re-create the table via pw.io.deltalake.write so the Pathway metadata is embedded.
  3. Check the Pathway version on both writer and reader sides and upgrade the writer to a version that stores the schema metadata.
Defensive patterns

Strategy: fallback

Validate before calling

from deltalake import DeltaTable

_DELTA_PATHWAY_META = "pathway"  # field metadata key used by pathway
def has_pathway_schema(uri: str, **opts) -> bool:
    dt = DeltaTable(uri, storage_options=opts)
    return any(
        f.metadata.get(_DELTA_PATHWAY_META) is not None
        for f in dt.schema().fields
    )

Try / catch

try:
    schema = pw.io.deltalake.read_deltalake_schema(uri)
except ValueError as e:
    if "No Pathway table schema" in str(e):
        # fall back to untyped read or Spark-written schema definition
        ...
    raise

Prevention

When it happens

Trigger: Calling pw.io.deltalake.read on a Delta table created externally (Spark/deltalake-rs/duckdb) or by an older Pathway version that did not embed the metadata.

Common situations: Team shares a Delta lake written by a Spark job and tries to consume it with Pathway's typed read; or a table written before the metadata feature shipped in a Pathway upgrade.

Related errors


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