{"record":{"id":"ac02448e71dd27c7","repo":"apache/hadoop","slug":"invalid-resource-name-specified","errorCode":null,"errorMessage":"Invalid resource name: {} specified.","messagePattern":"Invalid resource name: (.+?) specified\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java","lineNumber":787,"sourceCode":"          nodeName = matcher.group(NODE_IF_RACK_GROUP);\n        }\n        ResourceRequest amRackResourceRequest = rackRequests.get(rackName);\n        if (amRackResourceRequest == null) {\n          amRackResourceRequest = createAMResourceRequest(rackName, capability);\n          amResourceRequests.add(amRackResourceRequest);\n          rackRequests.put(rackName, amRackResourceRequest);\n        }\n        if (nodeName != null) {\n          amRackResourceRequest.setRelaxLocality(false);\n          ResourceRequest amNodeResourceRequest =\n              createAMResourceRequest(nodeName, capability);\n          amResourceRequests.add(amNodeResourceRequest);\n        }\n      } else {\n        String errMsg =\n            \"Invalid resource name: \" + amStrictResource + \" specified.\";\n        LOG.warn(errMsg);\n        throw new IOException(errMsg);\n      }\n    }\n    if (LOG.isDebugEnabled()) {\n      for (ResourceRequest amResourceRequest : amResourceRequests) {\n        LOG.debug(\"ResourceRequest: resource = \"\n            + amResourceRequest.getResourceName() + \", locality = \"\n            + amResourceRequest.getRelaxLocality());\n      }\n    }\n    return amResourceRequests;\n  }\n\n  private ResourceRequest createAMResourceRequest(String resource,\n      Resource capability) {\n    ResourceRequest resourceRequest =\n        recordFactory.newRecordInstance(ResourceRequest.class);\n    resourceRequest.setPriority(AM_CONTAINER_PRIORITY);\n    resourceRequest.setResourceName(resource);","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java#L769-L805","documentation":"When mapreduce.job.am.strict-locality (MRJobConfig.AM_STRICT_LOCALITY) pins the AM container, YARNRunner must interpret the value as either a rack (leading '/') or a node name resolved through RackResolver. It builds a rack request (and a node request with relaxLocality=false when a node name is resolved); if the value matches neither a resolvable node nor a rack, it logs a warning and throws IOException('Invalid resource name: ... specified.'), failing job submission.","triggerScenarios":"Setting mapreduce.job.am.strict-locality to a value that is not '/'-prefixed and not a node RackResolver can resolve (typo'd hostname, decommissioned/unknown node, an arbitrary string), then submitting the job through YARNRunner.","commonSituations":"Hardcoded node names after cluster hardware changes; rack names written without the leading '/'; copying a YARN node label or queue name into the strict-locality key by mistake; DNS or /etc/hosts differences between the client and the cluster's topology scripts.","solutions":["For a node, use the exact node name YARN reports (NodeManager host as shown in the RM UI / nodes REST endpoint) and verify RackResolver can resolve it from the client host","For a rack, prefix the value with '/' (e.g. /default-rack)","Unset mapreduce.job.am.strict-locality if strict AM placement is not actually required","Check that the client's topology configuration (net.topology.script.file.name) matches the cluster's, so rack resolution agrees with the RM"],"exampleFix":"# before\n<property><name>mapreduce.job.am.strict-locality</name><value>nod1.example.com</value></property>\n\n# after\n<property><name>mapreduce.job.am.strict-locality</name><value>node1.example.com</value></property>\n# or for a rack\n<property><name>mapreduce.job.am.strict-locality</name><value>/rack01</value></property>","handlingStrategy":"validation","validationCode":"String strict = conf.get(\"mapreduce.job.am.strict-locality\");\nif (strict != null && !strict.isEmpty()) {\n  if (strict.startsWith(\"/\")) {\n    // rack name: verify it exists in the cluster topology\n  } else {\n    List<Node> resolved = RackResolver.resolve(strict); // unknown/unresolvable node fails here\n    if (resolved == null || resolved.isEmpty() || !resolved.get(0).getName().equals(strict)) {\n      throw new IllegalArgumentException(\"strict-locality node not resolvable: \" + strict);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  jobClient.submitJob(jobConf);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid resource name:\")) {\n    jobConf.unset(\"mapreduce.job.am.strict-locality\"); // locality was optional\n    jobClient.submitJob(jobConf);\n  } else { throw e; }\n}","preventionTips":["Source node names from the RM nodes REST/UI rather than typing them","Remember racks need a leading '/' in strict-locality","Keep the client's topology configuration identical to the cluster's so RackResolver agrees with the RM"],"tags":["yarn","locality","scheduling","configuration","job-submission"],"backgroundTag":"unresolvable-hostname","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}