{"record":{"id":"e09ffa74fb33278c","repo":"pathwaycom/pathway","slug":"if-webserver-object-is-specified-host-and-port-sh","errorCode":null,"errorMessage":"If webserver object is specified, host and port shouldn't be set","messagePattern":"If webserver object is specified, host and port shouldn't be set","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/http/_server.py","lineNumber":854,"sourceCode":"        format = \"custom\"\n\n    if webserver is None:\n        if host is None or port is None:\n            raise ValueError(\n                \"If webserver object isn't specified, host and port must be present\"\n            )\n        if isinstance(port, str):\n            port = int(port)\n        warn(\n            \"The `host` and `port` arguments are deprecated. Please use `webserver` \"\n            \"instead.\",\n            DeprecationWarning,\n            stacklevel=2,\n        )\n        webserver = PathwayWebserver(host, port)\n    else:\n        if host is not None or port is not None:\n            raise ValueError(\n                \"If webserver object is specified, host and port shouldn't be set\"\n            )\n\n    input_table = io.python.read(\n        subject=RestServerSubject(\n            webserver=webserver,\n            route=route,\n            methods=methods,\n            schema=schema,\n            delete_completed_queries=delete_completed_queries,\n            format=format,\n            request_validator=request_validator,\n            documentation=documentation,\n            cache_strategy=cache_strategy,\n        ),\n        schema=schema,\n        format=\"json\",\n        autocommit_duration_ms=autocommit_duration_ms,","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/http/_server.py#L836-L872","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nwords, rw = pw.io.http.rest_connector(webserver=ws, host=\"127.0.0.1\", port=9999, route=\"/r\", schema=S)\n# after\nwords, rw = pw.io.http.rest_connector(webserver=ws, route=\"/r\", schema=S)","handlingStrategy":"validation","validationCode":"def call_connector(webserver, host, port, **kw):\n    if webserver is not None:\n        host = port = None  # never mix both styles\n    return pw.io.http.rest_connector(webserver=webserver, host=host, port=port, **kw)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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=."],"tags":["http","rest-connector","configuration","api-misuse","pathway"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}