{"record":{"id":"6da83894d202616b","repo":"apache/beam","slug":"file-path-must-be-absolute","errorCode":null,"errorMessage":"File path must be absolute: ","messagePattern":"File path must be absolute: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/fn/channel/SocketAddressFactory.java","lineNumber":41,"sourceCode":"import java.io.IOException;\nimport java.net.InetSocketAddress;\nimport java.net.SocketAddress;\nimport org.apache.beam.vendor.grpc.v1p69p0.io.netty.channel.unix.DomainSocketAddress;\nimport org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.net.HostAndPort;\n\n/** Creates a {@link SocketAddress} based upon a supplied string. */\npublic class SocketAddressFactory {\n  private static final String UNIX_DOMAIN_SOCKET_PREFIX = \"unix://\";\n\n  /** Parse a {@link SocketAddress} from the given string. */\n  public static SocketAddress createFrom(String value) {\n    if (value.startsWith(UNIX_DOMAIN_SOCKET_PREFIX)) {\n      // Unix Domain Socket address.\n      // Create the underlying file for the Unix Domain Socket.\n      String filePath = value.substring(UNIX_DOMAIN_SOCKET_PREFIX.length());\n      File file = new File(filePath);\n      if (!file.isAbsolute()) {\n        throw new IllegalArgumentException(\"File path must be absolute: \" + filePath);\n      }\n      try {\n        if (file.createNewFile()) {\n          // If this application created the file, delete it when the application exits.\n          file.deleteOnExit();\n        }\n      } catch (IOException ex) {\n        throw new RuntimeException(ex);\n      }\n      // Create the SocketAddress referencing the file.\n      return new DomainSocketAddress(file);\n    } else {\n      // Standard TCP/IP address.\n      HostAndPort hostAndPort = HostAndPort.fromString(value);\n      checkArgument(\n          hostAndPort.hasPort(),\n          \"Address must be a unix:// path or be in the form host:port. Got: %s\",\n          value);","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/fn/channel/SocketAddressFactory.java#L23-L59","documentation":"SocketAddressFactory.createFrom parses an endpoint string; values prefixed with the unix domain socket prefix must name an absolute file path, since domain sockets live in the filesystem. A relative path is ambiguous across processes and is rejected with IllegalArgumentException.","triggerScenarios":"Passing an endpoint like \"unix:relative.sock\" (path not starting with /) to Beam fn API channel/server configuration, e.g. via --endpoint or ApiServiceDescriptor URLs.","commonSituations":"Runner/container misconfiguration where the unix socket directory is omitted or configured with a relative path; job server started from a different working directory than the SDK harness.","solutions":["Use an absolute path in the unix socket endpoint, e.g. \"unix:/tmp/beam-socket\".","Start the job server and SDK harness with consistent working directories or explicit absolute socket paths.","Alternatively switch the endpoint to a TCP address like \"host:port\" to avoid filesystem path issues."],"exampleFix":"// before\n--endpoint=unix:beam.sock\n// after\n--endpoint=unix:/tmp/beam.sock","handlingStrategy":"validation","validationCode":"String path = endpoint.replaceFirst(\"^unix:\", \"\");\nif (!new File(path).isAbsolute()) throw new IllegalArgumentException(\"unix socket path must be absolute: \" + path);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure unix endpoints as unix:/absolute/path.sock","Set a fixed socket directory independent of the process working directory","Prefer TCP host:port endpoints when path handling is uncertain"],"tags":["beam","unix-domain-socket","endpoint","configuration"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}