{"record":{"id":"31ce91ec089c35af","repo":"apache/hadoop","slug":"no-scheme-in-default-fs-uri","errorCode":null,"errorMessage":"No scheme in default FS: ${uri}","messagePattern":"No scheme in default FS: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":301,"sourceCode":"   * Returns the configured FileSystem implementation.\n   * @param conf the configuration to use\n   * @return FileSystem.\n   * @throws IOException If an I/O error occurred.\n   */\n  public static FileSystem get(Configuration conf) throws IOException {\n    return get(getDefaultUri(conf), conf);\n  }\n\n  /**\n   * Get the default FileSystem URI from a configuration.\n   * @param conf the configuration to use\n   * @return the uri of the default filesystem\n   */\n  public static URI getDefaultUri(Configuration conf) {\n    URI uri =\n        URI.create(fixName(conf.getTrimmed(FS_DEFAULT_NAME_KEY, DEFAULT_FS)));\n    if (uri.getScheme() == null) {\n      throw new IllegalArgumentException(\"No scheme in default FS: \" + uri);\n    }\n    return uri;\n  }\n\n  /**\n   * Set the default FileSystem URI in a configuration.\n   * @param conf the configuration to alter\n   * @param uri the new default filesystem uri\n   */\n  public static void setDefaultUri(Configuration conf, URI uri) {\n    conf.set(FS_DEFAULT_NAME_KEY, uri.toString());\n  }\n\n  /** Set the default FileSystem URI in a configuration.\n   * @param conf the configuration to alter\n   * @param uri the new default filesystem uri\n   */\n  public static void setDefaultUri(Configuration conf, String uri) {","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L283-L319","documentation":"FileSystem.getDefaultUri(Configuration) reads fs.defaultFS (falling back to the legacy default), passes it through fixName (which only repairs the legacy 'local' and leading-'/' forms), and requires the resulting URI to have a scheme. A value like 'namenode:8020' parses as a URI with a null scheme, so the method throws IllegalArgumentException - the config must be fully qualified, e.g. hdfs://namenode:8020.","triggerScenarios":"Calling FileSystem.get(conf), FileSystem.getDefaultUri(conf), or any API that resolves the default filesystem while fs.defaultFS (or legacy fs.default.name) is set to a scheme-less value such as 'host:9000' or a bare hostname.","commonSituations":"Hand-edited or templated core-site.xml where the hdfs:// prefix was dropped or a ${...} variable failed to resolve; configs ported from host:port-style systems; XML where the property value got mangled.","solutions":["Set fs.defaultFS to a fully-qualified URI: hdfs://namenode:8020 (or file:/// for local)","Print the effective value at runtime: conf.get(\"fs.defaultFS\") - look for unresolved placeholders or truncation","Replace legacy fs.default.name forms ('local', '/path') with explicit file:/// values"],"exampleFix":"<!-- before -->\n<property><name>fs.defaultFS</name><value>namenode:8020</value></property>\n\n<!-- after -->\n<property><name>fs.defaultFS</name><value>hdfs://namenode:8020</value></property>","handlingStrategy":"validation","validationCode":"String raw = conf.getTrimmed(\"fs.defaultFS\", \"file:///\");\nURI u = URI.create(raw);\nif (u.getScheme() == null) {\n  throw new IllegalArgumentException(\n      \"fs.defaultFS must include a scheme (e.g. hdfs://host:8020): \" + raw);\n}\nFileSystem fs = FileSystem.get(conf);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write fs.defaultFS with an explicit scheme","Assert scheme non-null in an app-startup config self-check","Smoke-test new clusters with 'hadoop fs -ls /' before running jobs"],"tags":["hadoop","configuration","core-site","uri","fs-defaultfs"],"backgroundTag":"missing-uri-scheme","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}