{"record":{"id":"fa6a2453575f9ccb","repo":"pathwaycom/pathway","slug":"schemaregistrysettings-headers-i-must-be-a-sche","errorCode":null,"errorMessage":"SchemaRegistrySettings.headers[{i}] must be a SchemaRegistryHeader instance, got {type(header).__name__}. Use pw.io.kafka.SchemaRegistryHeader(key=..., value=...).","messagePattern":"SchemaRegistrySettings\\.headers\\[(.+?)\\] must be a SchemaRegistryHeader instance, got (.+?)\\. Use pw\\.io\\.kafka\\.SchemaRegistryHeader\\(key=\\.\\.\\., value=\\.\\.\\.\\)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/_io_helpers.py","lineNumber":314,"sourceCode":"                )\n        if self.password is not None and self.username is None:\n            raise ValueError(\n                \"SchemaRegistrySettings: 'password' was provided without \"\n                \"'username'. Both are needed for username/password \"\n                \"authentication.\"\n            )\n        if self.token_authorization is not None and (\n            self.username is not None or self.password is not None\n        ):\n            raise ValueError(\n                \"SchemaRegistrySettings: 'token_authorization' is mutually \"\n                \"exclusive with 'username'/'password'. Pick one \"\n                \"authentication method.\"\n            )\n        if self.headers is not None:\n            for i, header in enumerate(self.headers):\n                if not isinstance(header, SchemaRegistryHeader):\n                    raise TypeError(\n                        f\"SchemaRegistrySettings.headers[{i}] must be a \"\n                        f\"SchemaRegistryHeader instance, got \"\n                        f\"{type(header).__name__}. Use \"\n                        f\"pw.io.kafka.SchemaRegistryHeader(key=..., value=...).\"\n                    )\n        if self.timeout is not None:\n            if not isinstance(self.timeout, datetime.timedelta):\n                raise TypeError(\n                    f\"SchemaRegistrySettings.timeout must be a \"\n                    f\"datetime.timedelta, got {type(self.timeout).__name__}.\"\n                )\n            if self.timeout <= datetime.timedelta(0):\n                raise ValueError(\n                    f\"SchemaRegistrySettings: 'timeout' must be a positive \"\n                    f\"duration; got {self.timeout!r}.\"\n                )\n\n    @property","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/_io_helpers.py#L296-L332","documentation":"SchemaRegistrySettings.headers must be a list of SchemaRegistryHeader instances (a small key/value dataclass), not raw strings, tuples, or dicts. The registry client accesses header.key and header.value attributes to build HTTP headers, so any other element type is rejected with a TypeError in __post_init__. The message tells you to construct entries with pw.io.kafka.SchemaRegistryHeader(key=..., value=...).","triggerScenarios":"SchemaRegistrySettings(urls=[...], headers=[('x-tenant', 'acme')]) or headers=['x-tenant: acme'] or headers=[{'key': 'x-tenant', 'value': 'acme'}]; passing headers captured from another library (requests-style dict or tuple list).","commonSituations":"Reusing header formats from requests/httpx (dicts or tuple pairs) in Pathway Kafka settings; serializing headers to JSON and loading them back as dicts; porting code from confluent-kafka-python where headers are tuple pairs.","solutions":["Wrap each header in SchemaRegistryHeader: headers=[pw.io.kafka.SchemaRegistryHeader(key='x-tenant', value='acme')].","Convert tuple/dict headers at the boundary: [SchemaRegistryHeader(k, v) for k, v in raw].","Positional construction also works: SchemaRegistryHeader('x-tenant', 'acme')."],"exampleFix":"# before\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    headers=[{\"key\": \"x-tenant-id\", \"value\": \"42\"}],\n)\n\n# after\nfrom pathway.io.kafka import SchemaRegistryHeader\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    headers=[SchemaRegistryHeader(key=\"x-tenant-id\", value=\"42\")],\n)","handlingStrategy":"validation","validationCode":"from pathway.io.kafka import SchemaRegistryHeader\n\nraw_headers = [(\"x-tenant-id\", \"42\"), (\"x-trace\", \"abc\")]\nheaders = [SchemaRegistryHeader(key=k, value=v) for k, v in raw_headers]\nsettings = pw.io.kafka.SchemaRegistrySettings(urls=urls, headers=headers)","typeGuard":"def is_header_list(headers) -> bool:\n    from pathway.io.kafka import SchemaRegistryHeader\n    return headers is None or all(\n        isinstance(h, SchemaRegistryHeader) for h in headers\n    )","tryCatchPattern":null,"preventionTips":["Convert requests-style header dicts/tuples to SchemaRegistryHeader at the config boundary.","Do not round-trip header lists through JSON without a reconstruction step.","Import SchemaRegistryHeader from the same pathway.io.kafka module as the connector."],"tags":["kafka","schema-registry","type-error","headers"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}