pathwaycom/pathway · error · ValueError
If webserver object is specified, host and port shouldn't be
Error message
If webserver object is specified, host and port shouldn't be set
What it means
pw.io.http.rest_connector accepts either a webserver object or the deprecated host/port pair, never both. This ValueError fires when webserver is given and host or port is also not None, because the connector would not know which server configuration to use.
Source
Thrown at python/pathway/io/http/_server.py:854
format = "custom"
if webserver is None:
if host is None or port is None:
raise ValueError(
"If webserver object isn't specified, host and port must be present"
)
if isinstance(port, str):
port = int(port)
warn(
"The `host` and `port` arguments are deprecated. Please use `webserver` "
"instead.",
DeprecationWarning,
stacklevel=2,
)
webserver = PathwayWebserver(host, port)
else:
if host is not None or port is not None:
raise ValueError(
"If webserver object is specified, host and port shouldn't be set"
)
input_table = io.python.read(
subject=RestServerSubject(
webserver=webserver,
route=route,
methods=methods,
schema=schema,
delete_completed_queries=delete_completed_queries,
format=format,
request_validator=request_validator,
documentation=documentation,
cache_strategy=cache_strategy,
),
schema=schema,
format="json",
autocommit_duration_ms=autocommit_duration_ms,View on GitHub (pinned to fa2f74a464)
Solutions
- Remove the host and port arguments and keep only webserver=...
- If you intended the deprecated style instead, drop the webserver argument and pass both host and port.
Example fix
# before words, rw = pw.io.http.rest_connector(webserver=ws, host="127.0.0.1", port=9999, route="/r", schema=S) # after words, rw = pw.io.http.rest_connector(webserver=ws, route="/r", schema=S)
Defensive patterns
Strategy: validation
Validate before calling
def call_connector(webserver, host, port, **kw):
if webserver is not None:
host = port = None # never mix both styles
return pw.io.http.rest_connector(webserver=webserver, host=host, port=port, **kw) Prevention
- Pick one style (webserver= or host=/port=) and lint for the other in CI.
- When migrating legacy code, delete host/port in the same commit that adds webserver=.
When it happens
Trigger: rest_connector(webserver=ws, host='127.0.0.1', ...) or rest_connector(webserver=ws, port=9999, ...) — any call where a webserver object coexists with a non-None host or port argument.
Common situations: Partially migrating legacy code: the developer adds webserver=... but leaves old host/port arguments in place; copy-pasting a new example into old code that already sets host/port.
Related errors
- If webserver object isn't specified, host and port must be p
- 'raw' endpoint input format requires 'value' column in schem
- Missing topic name specification
- 'simple_read' does not accept {forbidden!r}. If you need to
- Failed to install dependencies
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/e09ffa74fb33278c.
Report an issue: GitHub.