{"record":{"id":"9e5f98ce866f2209","repo":"pathwaycom/pathway","slug":"schemaregistrysettings-field-name-must-be-a-str","errorCode":null,"errorMessage":"SchemaRegistrySettings.{field_name} must be a str, got {type(value).__name__}.","messagePattern":"SchemaRegistrySettings\\.(.+?) must be a str, got (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/_io_helpers.py","lineNumber":293,"sourceCode":"                f\"SchemaRegistrySettings.urls must be a list of strings, \"\n                f\"got {type(self.urls).__name__}. Wrap a single URL in a \"\n                f\"list: urls=['http://...'].\"\n            )\n        if not self.urls:\n            raise ValueError(\n                \"SchemaRegistrySettings requires at least one entry in 'urls'; \"\n                \"got an empty list.\"\n            )\n        for i, url in enumerate(self.urls):\n            if not isinstance(url, str) or not url:\n                raise ValueError(\n                    f\"SchemaRegistrySettings.urls[{i}] must be a non-empty \"\n                    f\"string; got {url!r}.\"\n                )\n        for field_name in (\"token_authorization\", \"username\", \"password\", \"proxy\"):\n            value = getattr(self, field_name)\n            if value is not None and not isinstance(value, str):\n                raise TypeError(\n                    f\"SchemaRegistrySettings.{field_name} must be a str, \"\n                    f\"got {type(value).__name__}.\"\n                )\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:","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/_io_helpers.py#L275-L311","documentation":"SchemaRegistrySettings.__post_init__ type-checks the optional string fields token_authorization, username, password, and proxy. If any of them is set to a non-None, non-str value (int, bytes, dict, etc.) a TypeError is raised naming the offending field and its actual type. The registry client sends these values verbatim in HTTP headers, so non-string values would fail later at the network layer; validation catches this at construction.","triggerScenarios":"Passing schema_registry_settings=SchemaRegistrySettings(urls=[...], username=user_id) where user_id is an int; passing password=bytes from os.environb; passing a token object or SecretStr instead of a str; passing timeout-like numeric values into proxy.","commonSituations":"Reading credentials from typed config objects (pydantic models,SecretStr), from JSON where a credential is accidentally numeric (e.g. username 12345), or passing bytes from environment access without decoding.","solutions":["Convert the offending field to str before construction, e.g. username=str(user_id).","If using pydantic SecretStr, unwrap it with .get_secret_value().","Decode bytes credentials with .decode('utf-8').","Move the value to the correct parameter (e.g. numeric timeout belongs in timeout=timedelta)."],"exampleFix":"# before\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    username=os.environb.get(b\"REGISTRY_USER\"),  # bytes\n)\n\n# after\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    username=os.environb.get(b\"REGISTRY_USER\", b\"\").decode(\"utf-8\"),\n)","handlingStrategy":"type-guard","validationCode":"auth_fields = {\"token_authorization\": token, \"username\": user, \"password\": pwd, \"proxy\": proxy}\nfor name, value in auth_fields.items():\n    if value is not None and not isinstance(value, str):\n        auth_fields[name] = str(value)\nsettings = pw.io.kafka.SchemaRegistrySettings(urls=urls, **auth_fields)","typeGuard":"def auth_fields_are_str(**fields) -> bool:\n    return all(v is None or isinstance(v, str) for v in fields.values())","tryCatchPattern":null,"preventionTips":["Decode bytes credentials with .decode('utf-8') at the point of env access.","Unwrap pydantic SecretStr with .get_secret_value() before passing to Pathway.","Keep one helper that normalizes all registry auth config to str|None and use it everywhere."],"tags":["kafka","schema-registry","type-error","configuration"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}