{"record":{"id":"2d9bf68f67da25a3","repo":"pathwaycom/pathway","slug":"schemaregistryheader-key-must-be-a-str-got-type","errorCode":null,"errorMessage":"SchemaRegistryHeader.key must be a str, got {type(self.key).__name__}.","messagePattern":"SchemaRegistryHeader\\.key must be a str, got (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/_io_helpers.py","lineNumber":233,"sourceCode":"@dataclasses.dataclass(frozen=True)\nclass SchemaRegistryHeader:\n    \"\"\"\n    Represents an additional header to be used in Confluent Schema Registry HTTP requests.\n\n    Args:\n        key: The header key.\n        value: The header value.\n\n    Returns:\n        The constructed header object\n    \"\"\"\n\n    key: str\n    value: str\n\n    def __post_init__(self):\n        if not isinstance(self.key, str):\n            raise TypeError(\n                f\"SchemaRegistryHeader.key must be a str, got \"\n                f\"{type(self.key).__name__}.\"\n            )\n        if not isinstance(self.value, str):\n            raise TypeError(\n                f\"SchemaRegistryHeader.value must be a str, got \"\n                f\"{type(self.value).__name__}.\"\n            )\n\n\n@dataclasses.dataclass(frozen=True)\nclass SchemaRegistrySettings:\n    \"\"\"\n    Connection settings for the Confluent Schema Registry.\n\n    Args:\n        urls: A list of URLs for connecting to the schema registry. If multiple URLs\n            are provided, they will be used in the specified order.","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/_io_helpers.py#L215-L251","documentation":"primary_key only affects how the snapshot output table is maintained in ClickHouse; in the default (append/streaming) output mode it has no effect and is therefore rejected to prevent silently ignored configuration.","triggerScenarios":"Calling pw.io.clickhouse.write(..., primary_key=t.id) while output_table_type is not \"snapshot\" (default mode).","commonSituations":"User adds primary_key expecting ClickHouse PRIMARY KEY semantics (which in Pathway are instead configured via table definition) without setting snapshot output; or leftover argument after switching output_table_type back to default.","solutions":["Remove primary_key if you want default append output.","Set output_table_type=\"snapshot\" if you intended keyed, up-to-date rows (and keep primary_key).","For engine-level keying, use pw.Table.with_id / primary_key on the Pathway table itself, not this argument."],"exampleFix":"# before\npw.io.clickhouse.write(t, \"db.events\", primary_key=t.id)\n\n# after\npw.io.clickhouse.write(t, \"db.events\")\n# or, for keyed snapshots:\npw.io.clickhouse.write(t, \"db.events\", output_table_type=\"snapshot\", primary_key=t.id)","handlingStrategy":"validation","validationCode":"if primary_key is not None:\n    assert output_table_type == \"snapshot\", (\n        \"primary_key requires output_table_type='snapshot'\"\n    )\npw.io.clickhouse.write(t, ..., output_table_type=output_table_type, primary_key=primary_key)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep output_table_type and primary_key in a single dataclass so they stay consistent.","Remember Pathway engine-level keys come from the Table, not from this writer argument."],"tags":["pathway","clickhouse","configuration","primary-key","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}