pathwaycom/pathway · error · ValueError
SchemaRegistrySettings: 'timeout' must be a positive duratio
Error message
SchemaRegistrySettings: 'timeout' must be a positive duration; got {self.timeout!r}. What it means
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).
Source
Thrown at python/pathway/internals/_io_helpers.py:327
"authentication method."
)
if self.headers is not None:
for i, header in enumerate(self.headers):
if not isinstance(header, SchemaRegistryHeader):
raise TypeError(
f"SchemaRegistrySettings.headers[{i}] must be a "
f"SchemaRegistryHeader instance, got "
f"{type(header).__name__}. Use "
f"pw.io.kafka.SchemaRegistryHeader(key=..., value=...)."
)
if self.timeout is not None:
if not isinstance(self.timeout, datetime.timedelta):
raise TypeError(
f"SchemaRegistrySettings.timeout must be a "
f"datetime.timedelta, got {type(self.timeout).__name__}."
)
if self.timeout <= datetime.timedelta(0):
raise ValueError(
f"SchemaRegistrySettings: 'timeout' must be a positive "
f"duration; got {self.timeout!r}."
)
@property
def to_engine(self):
return api.SchemaRegistrySettings(
self.urls,
token_authorization=self.token_authorization,
username=self.username,
password=self.password,
headers=[(header.key, header.value) for header in self.headers or []],
proxy=self.proxy,
timeout=self.timeout,
)
def is_s3_path(path: str) -> bool:View on GitHub (pinned to fa2f74a464)
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.
Example fix
# before
settings = pw.io.kafka.SchemaRegistrySettings(
urls=["http://registry:8081"],
timeout=datetime.timedelta(seconds=cfg.get("timeout", 0)),
)
# after
raw = cfg.get("timeout") or 30
settings = pw.io.kafka.SchemaRegistrySettings(
urls=["http://registry:8081"],
timeout=datetime.timedelta(seconds=raw),
) Defensive patterns
Strategy: validation
Validate before calling
import datetime
raw = cfg.get("registry_timeout")
timeout = None if not raw else datetime.timedelta(seconds=raw)
if timeout is not None and timeout <= datetime.timedelta(0):
raise ValueError(f"registry_timeout must be positive, got {raw}")
settings = pw.io.kafka.SchemaRegistrySettings(urls=urls, timeout=timeout) Type guard
import datetime
def is_positive_timedelta(v) -> bool:
return v is None or (isinstance(v, datetime.timedelta) and v > datetime.timedelta(0)) Prevention
- 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.
When it happens
Trigger: 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))).
Common situations: 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.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- SchemaRegistrySettings.urls[{i}] must be a non-empty string;
- SchemaRegistrySettings.timeout must be a datetime.timedelta,
- 'subject' was provided without 'schema_registry_settings'. T
- 'schema_registry_settings' was provided without 'subject'. W
- 'subject' must be a non-empty string; got an empty string. S
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/cf6b29fc840c1401.
Report an issue: GitHub.