{"record":{"id":"cf6b29fc840c1401","repo":"pathwaycom/pathway","slug":"schemaregistrysettings-timeout-must-be-a-positi","errorCode":null,"errorMessage":"SchemaRegistrySettings: 'timeout' must be a positive duration; got {self.timeout!r}.","messagePattern":"SchemaRegistrySettings: 'timeout' must be a positive duration; got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/_io_helpers.py","lineNumber":327,"sourceCode":"                \"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\n    def to_engine(self):\n        return api.SchemaRegistrySettings(\n            self.urls,\n            token_authorization=self.token_authorization,\n            username=self.username,\n            password=self.password,\n            headers=[(header.key, header.value) for header in self.headers or []],\n            proxy=self.proxy,\n            timeout=self.timeout,\n        )\n\n\ndef is_s3_path(path: str) -> bool:","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/_io_helpers.py#L309-L345","documentation":"SchemaRegistrySettings requires timeout to be a strictly positive datetime.timedelta. A zero or negative duration is meaningless for an HTTP request deadline and usually indicates a unit mistake (e.g. timedelta(seconds=0)) or an unset config value defaulting to zero. The ValueError fires in __post_init__ whenever timeout <= timedelta(0).","triggerScenarios":"SchemaRegistrySettings(urls=[...], timeout=datetime.timedelta(0)); timeout=datetime.timedelta(seconds=-1); building the timedelta from a config value that defaults to 0 (timeout=timedelta(seconds=cfg.get('timeout', 0))).","commonSituations":"A 'timeout' setting of 0 used elsewhere to mean 'no timeout' or 'disabled'; negative values from misparsed config; tests that construct settings with dummy zero values.","solutions":["Set a positive duration, e.g. timeout=timedelta(seconds=30).","If 0 in your config means 'default/disable', translate it to None before constructing settings.","Validate config values at load time so bad timeouts surface with a clearer message."],"exampleFix":"# before\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    timeout=datetime.timedelta(seconds=cfg.get(\"timeout\", 0)),\n)\n\n# after\nraw = cfg.get(\"timeout\") or 30\nsettings = pw.io.kafka.SchemaRegistrySettings(\n    urls=[\"http://registry:8081\"],\n    timeout=datetime.timedelta(seconds=raw),\n)","handlingStrategy":"validation","validationCode":"import datetime\n\nraw = cfg.get(\"registry_timeout\")\ntimeout = None if not raw else datetime.timedelta(seconds=raw)\nif timeout is not None and timeout <= datetime.timedelta(0):\n    raise ValueError(f\"registry_timeout must be positive, got {raw}\")\nsettings = pw.io.kafka.SchemaRegistrySettings(urls=urls, timeout=timeout)","typeGuard":"import datetime\n\ndef is_positive_timedelta(v) -> bool:\n    return v is None or (isinstance(v, datetime.timedelta) and v > datetime.timedelta(0))","tryCatchPattern":null,"preventionTips":["Treat 0/absent timeout in config as 'use default' (None), never pass timedelta(0).","Validate numeric config ranges at load time so bad values fail with your own message."],"tags":["kafka","schema-registry","timeout","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}