{"record":{"id":"abe27be0654eb852","repo":"apache/hadoop","slug":"proxy-error-incorrect-fs-s3a-proxy-host-or-fs-s3a","errorCode":null,"errorMessage":"Proxy error: incorrect fs.s3a.proxy.host or fs.s3a.proxy.port","messagePattern":"Proxy error: incorrect fs\\.s3a\\.proxy\\.host or fs\\.s3a\\.proxy\\.port","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/AWSClientConfig.java","lineNumber":367,"sourceCode":"\n    return proxyConfigBuilder.build();\n  }\n\n  /**\n   * Builds a URI, throws an IllegalArgumentException in case of errors.\n   *\n   * @param host proxy host\n   * @param port proxy port\n   * @return uri with host and port\n   */\n  private static URI buildURI(String scheme, String host, int port) {\n    try {\n      return new URI(scheme, null, host, port, null, null, null);\n    } catch (URISyntaxException e) {\n      String msg =\n          \"Proxy error: incorrect \" + PROXY_HOST + \" or \" + PROXY_PORT;\n      LOG.error(msg);\n      throw new IllegalArgumentException(msg);\n    }\n  }\n\n  /**\n   * Initializes the User-Agent header to send in HTTP requests to AWS\n   * services.  We always include the Hadoop version number.  The user also\n   * may set an optional custom prefix to put in front of the Hadoop version\n   * number.  The AWS SDK internally appends its own information, which seems\n   * to include the AWS SDK version, OS and JVM version.\n   *\n   * @param conf Hadoop configuration\n   * @param clientConfig AWS SDK configuration to update\n   */\n  private static void initUserAgent(Configuration conf,\n      ClientOverrideConfiguration.Builder clientConfig) {\n    String userAgent = \"Hadoop \" + VersionInfo.getVersion();\n    String userAgentPrefix = conf.getTrimmed(USER_AGENT_PREFIX, \"\");\n    if (!userAgentPrefix.isEmpty()) {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/AWSClientConfig.java#L349-L385","documentation":"IllegalArgumentException from AWSClientConfig.buildURI when java.net.URI rejects the proxy endpoint assembled from scheme, host and port (URISyntaxException). buildURI is used to construct the proxy endpoint URI for both sync and async clients (for example when the host is set without a port it defaults to http/80 with a logged warning). The message deliberately names fs.s3a.proxy.host and fs.s3a.proxy.port as the suspects.","triggerScenarios":"fs.s3a.proxy.host contains characters illegal in a URI host -- spaces, 'http://' prefixes, slashes, underscores in some strict parses -- or the port is outside 0-65535, so 'new URI(scheme, null, host, port, ...)' throws.","commonSituations":"Host pasted as 'http://proxy.corp:8080' instead of the bare hostname; whitespace or a trailing slash in the XML value; port parsed from a templated variable that produced a negative or non-numeric value.","solutions":["Set fs.s3a.proxy.host to a bare hostname or IP (no scheme, no path, no port)","Set fs.s3a.proxy.port to a plain integer in 0-65535","Trim the values / fix the templating that injected whitespace or the full URL"],"exampleFix":"<!-- before -->\n<property><name>fs.s3a.proxy.host</name><value>http://proxy.corp:8080</value></property>\n\n<!-- after -->\n<property><name>fs.s3a.proxy.host</name><value>proxy.corp</value></property>\n<property><name>fs.s3a.proxy.port</name><value>8080</value></property>","handlingStrategy":"validation","validationCode":"String host = conf.getTrimmed(\"fs.s3a.proxy.host\");\nint port = conf.getInt(\"fs.s3a.proxy.port\", -1);\ntry {\n  new java.net.URI(\"http\", null, host, port, null, null, null);\n} catch (java.net.URISyntaxException bad) {\n  throw new IllegalArgumentException(\"Proxy host/port not URI-safe: \" + host + \":\" + port, bad);\n}","typeGuard":null,"tryCatchPattern":"try {\n  FileSystem fs = path.getFileSystem(conf);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"incorrect fs.s3a.proxy\")) {\n    // host or port contains illegal characters/range: fix values, do not retry\n    LOG.error(\"Proxy host/port rejected by URI parser\", e);\n  }\n}","preventionTips":["Store only the bare hostname in fs.s3a.proxy.host -- never a URL with scheme or port","Range-check the port (0-65535) in config templates","Trim whitespace from XML values to avoid invisible URI-unsafe characters"],"tags":["s3a","proxy","uri-parsing","configuration"],"backgroundTag":"invalid-proxy-host","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}