apache/hadoop · error · IllegalArgumentException

Unable to parse '{}' as a URI, check the setting for mapredu

Error message

Unable to parse '{}' as a URI, check the setting for mapreduce.application.framework.path

What it means

MRApps.getMRFrameworkName parses mapreduce.application.framework.path with new URI(framework) to extract the framework name (URI fragment if present, else the path's last component). If the configured string is not a syntactically valid URI, it rethrows as IllegalArgumentException naming the exact key and echoing the bad value. This key points jobs at an alternative MapReduce framework bundle instead of the built-in one.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java:180

    return TaskAttemptStateUI.valueOf(attemptStateStr);
  }

  public static TaskStateUI taskState(String taskStateStr) {
    return TaskStateUI.valueOf(taskStateStr);
  }

  // gets the base name of the MapReduce framework or null if no
  // framework was configured
  private static String getMRFrameworkName(Configuration conf) {
    String frameworkName = null;
    String framework =
        conf.get(MRJobConfig.MAPREDUCE_APPLICATION_FRAMEWORK_PATH, "");
    if (!framework.isEmpty()) {
      URI uri;
      try {
        uri = new URI(framework);
      } catch (URISyntaxException e) {
        throw new IllegalArgumentException("Unable to parse '" + framework
            + "' as a URI, check the setting for "
            + MRJobConfig.MAPREDUCE_APPLICATION_FRAMEWORK_PATH, e);
      }

      frameworkName = uri.getFragment();
      if (frameworkName == null) {
        frameworkName = new Path(uri).getName();
      }
    }
    return frameworkName;
  }

  private static void setMRFrameworkClasspath(
      Map<String, String> environment, Configuration conf) throws IOException {
    // Propagate the system classpath when using the mini cluster
    if (conf.getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false)) {
      MRApps.addToEnvironment(environment, Environment.CLASSPATH.name(),
          System.getProperty("java.class.path"), conf);

View on GitHub (pinned to 2add963021)

Solutions

  1. Fix the value to be a valid URI, e.g. 'hdfs://nn/user/me/mr-framework.zip#mr-framework' (URL-encode unsafe characters)
  2. Leave mapreduce.application.framework.path unset to use the default MapReduce framework
  3. Validate the setting by parsing it with java.net.URI in a config lint step before deploying

Example fix

# before
<property><name>mapreduce.application.framework.path</name>
  <value>hdfs:///opt/mr framework.zip</value></property>

# after
<property><name>mapreduce.application.framework.path</name>
  <value>hdfs:///opt/mr-framework.zip#mr-framework</value></property>
Defensive patterns

Strategy: validation

Validate before calling

String framework = conf.get("mapreduce.application.framework.path", "");
if (!framework.isEmpty()) {
  try { new URI(framework); }
  catch (URISyntaxException e) {
    throw new ConfigException("mapreduce.application.framework.path is not a valid URI: " + framework);
  }
}

Try / catch

try {
  uri = new URI(framework);
} catch (URISyntaxException e) {
  throw new IllegalArgumentException(
      "Fix mapreduce.application.framework.path: " + framework, e);
}

Prevention

When it happens

Trigger: Setting mapreduce.application.framework.path to a value java.net.URI cannot parse: unescaped spaces, malformed scheme, stray characters — e.g. 'hdfs://nn/opt/my framework.zip'.

Common situations: Site config pasted from documentation with spaces in paths; environment-variable substitution producing an empty/garbled value; copying a local path into an hdfs URI incorrectly.

Understand the failure class

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/10266dc0b8547c24. Report an issue: GitHub.