{"record":{"id":"5db9fd41aca17b6c","repo":"apache/hadoop","slug":"the-supplied-filesystem-base-path-uri-is-not-a-val","errorCode":null,"errorMessage":"The supplied filesystem base path URI is not a valid URI: ${basePath}","messagePattern":"The supplied filesystem base path URI is not a valid URI: (.+?)","errorType":"exception","errorClass":"MetricsException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSink.java","lineNumber":467,"sourceCode":"  }\n\n  /**\n   * Return the supplied file system for testing or otherwise get a new file\n   * system.\n   *\n   * @return the file system to use\n   * @throws MetricsException thrown if the file system could not be retrieved\n   */\n  private FileSystem getFileSystem() throws MetricsException {\n    FileSystem fs = null;\n\n    if (suppliedFilesystem != null) {\n      fs = suppliedFilesystem;\n    } else {\n      try {\n        fs = FileSystem.get(new URI(basePath.toString()), conf);\n      } catch (URISyntaxException ex) {\n        throw new MetricsException(\"The supplied filesystem base path URI\"\n            + \" is not a valid URI: \" + basePath.toString(), ex);\n      } catch (IOException ex) {\n        throw new MetricsException(\"Error connecting to file system: \"\n            + basePath + \" [\" + ex.toString() + \"]\", ex);\n      }\n    }\n\n    return fs;\n  }\n\n  /**\n   * Test whether the file system supports append and return the answer.\n   *\n   * @param fs the target file system\n   */\n  private boolean checkAppend(FileSystem fs) {\n    boolean canAppend = true;\n","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSink.java#L449-L485","documentation":"getFileSystem() builds new URI(basePath.toString()) to obtain the FileSystem for the sink's basepath. basePath is itself constructed via new Path(<basepath property>), which accepts characters that are illegal in a URI — spaces, percent signs, some non-ASCII — so the URI constructor can throw URISyntaxException, wrapped here with the offending path in the message.","triggerScenarios":"basepath containing URI-hostile characters, e.g. basepath=/metrics my logs or hdfs://nn/user/hdfs/metrics (old) where the directory name has a space or stray % character.","commonSituations":"Paths copied from shell commands or documentation containing spaces; directory names with special characters; Windows-style paths with drive letters in exotic setups.","solutions":["Remove or encode the offending characters (replace spaces or percent-encode them)","Prefer a clean scheme-qualified path: basepath=hdfs://nameservice/metrics","Test the value: new URI(new Path(value).toString()) in a scratch program or jshell before deploying"],"exampleFix":"# before\n*.sink.rolling.basepath=/tmp/hadoop metrics/  # space makes basePath an invalid URI\n\n# after\n*.sink.rolling.basepath=/tmp/hadoop-metrics/","handlingStrategy":"validation","validationCode":"try {\n  new URI(new Path(basepathValue).toString());\n} catch (URISyntaxException e) {\n  throw new IllegalArgumentException(\"basepath '\" + basepathValue\n      + \"' is not URI-safe (spaces/special chars?): \" + e.getReason(), e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  sink.init(subsetConf);\n} catch (MetricsException e) {\n  // 'The supplied filesystem base path URI is not a valid URI' — sanitize the basepath value\n  LOG.error(\"basepath '{}' contains URI-illegal characters\", basepath, e);\n}","preventionTips":["Keep basepath free of spaces and URI-reserved characters (%, ?, #)","Prefer fully qualified paths (hdfs://nameservice/metrics) — they also pin the intended filesystem","Run new URI(path) as a config sanity check in deployment pipelines"],"tags":["metrics2","rolling-file-sink","uri","configuration"],"backgroundTag":"invalid-uri","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}