{"record":{"id":"3d64c2937113e5f9","repo":"sgl-project/sglang","slug":"field-name-port-must-be-between-0-and-65535-po","errorCode":null,"errorMessage":"{field_name} port must be between 0 and 65535: {port}","messagePattern":"(.+?) port must be between 0 and 65535: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/common.py","lineNumber":149,"sourceCode":"    try:\n        host, port_str = addr.rsplit(\":\", 1)\n    except ValueError as exc:\n        raise ValueError(\n            f\"{field_name} must be formatted as tcp://host:port or host:port\"\n        ) from exc\n\n    host = host.strip()\n    port_str = port_str.strip()\n    if not host or not port_str:\n        raise ValueError(f\"{field_name} must include both host and port: {value!r}\")\n\n    try:\n        port = int(port_str)\n    except ValueError as exc:\n        raise ValueError(f\"{field_name} port must be an integer: {port_str}\") from exc\n\n    if port < 0 or port > 65535:\n        raise ValueError(f\"{field_name} port must be between 0 and 65535: {port}\")\n    return host, port\n\n\ndef format_tcp_endpoint(host: str, port: int, field_name: str) -> str:\n    if port < 0 or port > 65535:\n        raise ValueError(f\"{field_name} port must be between 0 and 65535: {port}\")\n    return f\"tcp://{host}:{port}\"\n\n\ndef configure_ipv6(dist_init_addr):\n    addr = dist_init_addr\n    end = addr.find(\"]\")\n    if end == -1:\n        raise ValueError(\"invalid IPv6 address format: missing ']'\")\n\n    host = addr[: end + 1]\n\n    # this only validates the address without brackets: we still need the below checks.","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/common.py#L131-L167","documentation":"Thrown by parse_tcp_host_port when the parsed port integer falls outside 0–65535, the valid TCP port range enforced by the function.","triggerScenarios":"Passing \"host:70000\" or \"host:-1\" to parse_tcp_host_port — int() succeeds but the range check fails.","commonSituations":"Port computed from a base + offset overflowing past 65535; typo adding an extra digit; using a process id or other large number as a port.","solutions":["Choose a port in 0–65535 (unprivileged ports 1024–65535 for non-root)","If deriving ports arithmetically, clamp or wrap into the valid range","Fix the typo in the configured port number"],"exampleFix":"# before\nendpoint = \"0.0.0.0:70000\"\n# after\nendpoint = \"0.0.0.0:7000\"","handlingStrategy":"validation","validationCode":"assert 0 <= int(port_str) <= 65535, \"port out of range\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp generated ports into 1024–65535 when computing them from offsets"],"tags":["zmq","endpoint","port","validation"],"backgroundTag":"port-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}