{"record":{"id":"7440daa2d28a202a","repo":"apache/beam","slug":"expected-the-endpoint-to-be-of-the-form-host-port-but","errorCode":null,"errorMessage":"Expected the endpoint to be of the form <host>:<port> but received {url}","messagePattern":"Expected the endpoint to be of the form <host>:<port> but received (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java","lineNumber":80,"sourceCode":"  }\n\n  // Waits till all expansion services are ready.\n  private void waitForAllServicesToBeReady() throws TimeoutException {\n    if (disableServiceCheck) {\n      // Service check disabled. Just returning.\n      return;\n    }\n\n    outer:\n    for (Endpoints.ApiServiceDescriptor endpoint : endpoints) {\n      long start = System.currentTimeMillis();\n      long duration = 10;\n      while (System.currentTimeMillis() - start < SERVICE_CHECK_TIMEOUT_MILLIS) {\n        try {\n          String url = endpoint.getUrl();\n          int portIndex = url.lastIndexOf(\":\");\n          if (portIndex <= 0) {\n            throw new RuntimeException(\n                \"Expected the endpoint to be of the form <host>:<port> but received \" + url);\n          }\n          int port = Integer.parseInt(url.substring(portIndex + 1));\n          String host = url.substring(0, portIndex);\n          new Socket(host, port).close();\n          // Current service is up. Checking the next one.\n          continue outer;\n        } catch (IOException exn) {\n          try {\n            Thread.sleep(duration);\n          } catch (InterruptedException e) {\n            // Ignore\n          }\n          duration = (long) (duration * 1.2);\n        }\n      }\n      throw new TimeoutException(\n          \"Timeout waiting for the service \"","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java#L62-L98","documentation":"ExpansionService.waitForAllServicesToBeReady probes each expansion service endpoint by opening a TCP socket to <host>:<port>. To parse the endpoint URL it takes everything after the last ':' as the port; if the URL has no ':' at position > 0 (portIndex <= 0), the endpoint is not in the expected <host>:<port> form and a RuntimeException is thrown.","triggerScenarios":"Calling expand() or discoverSchemaTransform() when a configured expansion service endpoint's ApiServiceDescriptor URL lacks a host:port form — e.g. an empty URL, a URL with only a port (\":1234\" gives portIndex==0), or a scheme-less malformed endpoint string.","commonSituations":"Misconfigured pipeline option for the transform service address (empty string); environment templating leaving the endpoint blank; providing a URL like \"localhost\" with no port.","solutions":["Set the transform service endpoint option to a full host:port value, e.g. localhost:50051.","Check the environment/config that supplies the endpoint for empty or truncated values.","Verify the service was started correctly (the launcher normally registers host:port endpoints)."],"exampleFix":"// before\n--transformServiceEndpoint=localhost\n\n// after\n--transformServiceEndpoint=localhost:50051","handlingStrategy":"validation","validationCode":"String url = endpointUrl;\nint i = url.lastIndexOf(\":\");\nif (i <= 0 || !url.substring(i + 1).matches(\"\\\\d+\"))\n  throw new IllegalArgumentException(\"endpoint must be <host>:<port>, got: \" + url);","typeGuard":null,"tryCatchPattern":"try {\n  expansionService.expand(...);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Expected the endpoint\"))\n    LOG.error(\"Fix the transform service endpoint option to host:port\");\n  throw e;\n}","preventionTips":["Never leave the endpoint pipeline option empty; template with a default like localhost:50051.","Validate endpoint strings at config-load time with a host:port regex.","Fail fast on empty env substitutions in deployment scripts."],"tags":["java","url","endpoint","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}