pathwaycom/pathway · error · ValueError

If webserver object isn't specified, host and port must be p

Error message

If webserver object isn't specified, host and port must be present

What it means

pw.io.http.rest_connector requires a server to attach the REST endpoint to. You must either pass an existing PathwayWebserver object via the webserver argument, or supply both host and port so the connector can create one. This ValueError is raised when webserver is None and at least one of host/port is also None.

Source

Thrown at python/pathway/io/http/_server.py:840

                + " It will soon be required."
            )
            delete_completed_queries = True
        else:
            warn(
                "DEPRECATED: keep_queries arg of rest_connector is deprecated,"
                + " use delete_completed_queries with an opposite meaning instead."
            )
            delete_completed_queries = not keep_queries

    if schema is None:
        format = "raw"
        schema = pw.schema_builder({"query": pw.column_definition()})
    else:
        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(

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Preferred: create and pass a webserver: webserver = pw.io.http.PathwayWebserver(host='127.0.0.1', port=9999) then rest_connector(webserver=webserver, ...).
  2. Alternatively supply both host and port directly: rest_connector(host='127.0.0.1', port=9999, ...) (emits a DeprecationWarning).
  3. Reuse the same webserver object for multiple endpoints on the same host/port instead of creating new ones.

Example fix

# before
words, rw = pw.io.http.rest_connector(route="/uppercase", schema=WordsSchema)
# after
webserver = pw.io.http.PathwayWebserver(host="127.0.0.1", port=9999)
words, rw = pw.io.http.rest_connector(webserver=webserver, route="/uppercase", schema=WordsSchema)
Defensive patterns

Strategy: validation

Validate before calling

def validate_connector_endpoint(webserver, host, port):
    if webserver is None and (host is None or port is None):
        raise SystemExit("Provide a PathwayWebserver or both host and port.")

validate_connector_endpoint(webserver, host, port)
words, rw = pw.io.http.rest_connector(webserver=webserver, route="/r", schema=S)

Prevention

When it happens

Trigger: Calling rest_connector(route='/uppercase', schema=WordsSchema) with no webserver, host, or port; or passing only host='127.0.0.1' without port; or passing port=9999 as positional/keyword without host.

Common situations: Migrating from an older Pathway version where host/port were the only API and then removing them during the webserver migration; forgetting that both host AND port are required together; copy-pasting examples that create the webserver separately but never passing it in.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/dcb53a922481b67b. Report an issue: GitHub.