{"record":{"id":"28578f7953d946c4","repo":"apache/hadoop","slug":"environment-variable-does-not-exist-var","errorCode":null,"errorMessage":"Environment variable does not exist {var}","messagePattern":"Environment variable does not exist (.+?)","errorType":"validation","errorClass":"UploaderException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-uploader/src/main/java/org/apache/hadoop/mapred/uploader/FrameworkUploader.java","lineNumber":398,"sourceCode":"    }\n  }\n\n  @VisibleForTesting\n  String expandEnvironmentVariables(String innerInput, Map<String, String> env)\n      throws UploaderException {\n    boolean found;\n    do {\n      found = false;\n      Matcher matcher = VAR_SUBBER.matcher(innerInput);\n      StringBuffer stringBuffer = new StringBuffer();\n      while (matcher.find()) {\n        found = true;\n        String var = matcher.group(1);\n        // replace $env with the child's env constructed by tt's\n        String replace = env.get(var);\n        // the env key is not present anywhere .. simply set it\n        if (replace == null) {\n          throw new UploaderException(\"Environment variable does not exist \" +\n              var);\n        }\n        matcher.appendReplacement(\n            stringBuffer, Matcher.quoteReplacement(replace));\n      }\n      matcher.appendTail(stringBuffer);\n      innerInput = stringBuffer.toString();\n    } while (found);\n    return innerInput;\n  }\n\n  private void addJar(File jar) throws UploaderException{\n    boolean found = false;\n    if (!jar.getName().endsWith(\".jar\")) {\n      LOG.info(\"Ignored non-jar \" + jar.getAbsolutePath());\n    }\n    for (Pattern pattern : whitelistedFiles) {\n      Matcher matcher = pattern.matcher(jar.getAbsolutePath());","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-uploader/src/main/java/org/apache/hadoop/mapred/uploader/FrameworkUploader.java#L380-L416","documentation":"Error \"Environment variable does not exist {var}\" thrown in apache/hadoop.","triggerScenarios":"Thrown by FrameworkUploader when a required environment variable referenced by the upload configuration is not set. Export the named environment variable before running the framework uploader.","commonSituations":"See trigger scenarios.","solutions":["Set the required environment variable before running the uploader, or pass the value via the corresponding CLI option/config key.","Check the FrameworkUploader documentation for the expected variable name and export it in the shell."],"exampleFix":"export HADOOP_HOME=/opt/hadoop && yarn jar ... FrameworkUploader ...","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-22T20:17:22.307Z"}