{"record":{"id":"a34a9e5c7eec7d9d","repo":"apache/hadoop","slug":"filesystem-implementation-error-default-port-d","errorCode":null,"errorMessage":"FileSystem implementation error -  default port {defaultPort} is not valid","messagePattern":"FileSystem implementation error -  default port (.+?) is not valid","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":322,"sourceCode":"   * part of the given URI is stripped out and default file system port is used\n   * to form the URI.\n   * \n   * @param uri FileSystem URI.\n   * @param authorityNeeded if true authority cannot be null in the URI. If\n   *          false authority must be null.\n   * @param defaultPort default port to use if port is not specified in the URI.\n   * \n   * @return URI of the file system\n   * \n   * @throws URISyntaxException <code>uri</code> has syntax error\n   */\n  private URI getUri(URI uri, String supportedScheme,\n      boolean authorityNeeded, int defaultPort) throws URISyntaxException {\n    checkScheme(uri, supportedScheme);\n    // A file system implementation that requires authority must always\n    // specify default port\n    if (defaultPort < 0 && authorityNeeded) {\n      throw new HadoopIllegalArgumentException(\n          \"FileSystem implementation error -  default port \" + defaultPort\n              + \" is not valid\");\n    }\n    String authority = uri.getAuthority();\n    if (authority == null) {\n       if (authorityNeeded) {\n         throw new HadoopIllegalArgumentException(\"Uri without authority: \" + uri);\n       } else {\n         return new URI(supportedScheme + \":///\");\n       }   \n    }\n    // authority is non null  - AuthorityNeeded may be true or false.\n    int port = uri.getPort();\n    port = (port == -1 ? defaultPort : port);\n    if (port == -1) { // no port supplied and default port is not specified\n      return new URI(supportedScheme, authority, \"/\", null);\n    }\n    return new URI(supportedScheme + \"://\" + uri.getHost() + \":\" + port);","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L304-L340","documentation":"Error \"FileSystem implementation error -  default port {defaultPort} is not valid\" thrown in apache/hadoop.","triggerScenarios":"Raised at runtime when the documented precondition or configuration requirement for this operation is violated.","commonSituations":"Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.","solutions":["Fix the default port constant returned by this FileSystem implementation to a valid port number."],"exampleFix":"Return a port in 1-65535 from getUriDefaultPort().","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}