{"record":{"id":"df7411e8b859a868","repo":"apache/hadoop","slug":"invalid-reservationid-specified-for-the-app","errorCode":null,"errorMessage":"Invalid reservationId: {} specified for the app: {}","messagePattern":"Invalid reservationId: (.+?) specified for the app: (.+?)","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":622,"sourceCode":"    ApplicationSubmissionContext appContext =\n        recordFactory.newRecordInstance(ApplicationSubmissionContext.class);\n    appContext.setApplicationId(applicationId);                // ApplicationId\n    appContext.setQueue(                                       // Queue name\n        jobConf.get(JobContext.QUEUE_NAME,\n        YarnConfiguration.DEFAULT_QUEUE_NAME));\n    // add reservationID if present\n    ReservationId reservationID = null;\n    try {\n      reservationID =\n          ReservationId.parseReservationId(jobConf\n              .get(JobContext.RESERVATION_ID));\n    } catch (NumberFormatException e) {\n      // throw exception as reservationid as is invalid\n      String errMsg =\n          \"Invalid reservationId: \" + jobConf.get(JobContext.RESERVATION_ID)\n              + \" specified for the app: \" + applicationId;\n      LOG.warn(errMsg);\n      throw new IOException(errMsg);\n    }\n    if (reservationID != null) {\n      appContext.setReservationID(reservationID);\n      LOG.info(\"SUBMITTING ApplicationSubmissionContext app:\" + applicationId\n          + \" to queue:\" + appContext.getQueue() + \" with reservationId:\"\n          + appContext.getReservationID());\n    }\n    appContext.setApplicationName(                             // Job name\n        jobConf.get(JobContext.JOB_NAME,\n        YarnConfiguration.DEFAULT_APPLICATION_NAME));\n    appContext.setCancelTokensWhenComplete(\n        conf.getBoolean(MRJobConfig.JOB_CANCEL_DELEGATION_TOKEN, true));\n    appContext.setAMContainerSpec(amContainer);         // AM Container\n    appContext.setMaxAppAttempts(\n        conf.getInt(MRJobConfig.MR_AM_MAX_ATTEMPTS,\n            MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS));\n\n    // Setup the AM ResourceRequests","sourceCodeStart":604,"sourceCodeEnd":640,"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#L604-L640","documentation":"YARNRunner.submitJob reads mapreduce.job.reservation.id and passes it to ReservationId.parseReservationId. That method accepts 'reservation_<clusterTimestamp>_<seq>' and, when the prefix and field count pass but the timestamp or sequence part is not numeric, throws NumberFormatException. YARNRunner converts it into an IOException that names the bad value and the application ID, aborting job submission before the ApplicationSubmissionContext reaches the ResourceManager.","triggerScenarios":"Setting mapreduce.job.reservation.id (JobContext.RESERVATION_ID) to a string like 'reservation_abc_1' or 'reservation_1234_xyz' (non-numeric timestamp/sequence fields), then calling JobClient.submitJob / YARNRunner.submitJob. Note: values with a wrong prefix or wrong underscore-field count fail inside parseReservationId with IOException before the NumberFormatException path, so this specific message implies the shape was right but a field was non-numeric.","commonSituations":"Hand-typed reservation IDs in scripts or CLI flags; reservation IDs copied with extra characters or split across shell variables; passing IDs generated by a different cluster or tool that formats timestamps with separators; forgetting that only IDs returned by the YARN ReservationSystem are valid.","solutions":["Use the exact string returned by ReservationId.toString() from the reservation system that created it (format: reservation_<clusterTimestamp>_<sequence>, both numeric)","If no reservation is intended, unset mapreduce.job.reservation.id instead of leaving a placeholder value","Validate the value with ReservationId.parseReservationId before job submission so the failure surfaces at the configuration boundary, not inside submitJob","Check the ResourceManager/capacity scheduler reservationACLs and reservation system logs to re-obtain the correct ID if it came from an automation pipeline"],"exampleFix":"// before\nconf.set(\"mapreduce.job.reservation.id\", \"res-2026-07-01\");\n\n// after\nReservationId rid = reservationClient.getReservationReservationId(...); // from ReservationSystem\nconf.set(\"mapreduce.job.reservation.id\", rid.toString()); // e.g. \"reservation_1689372000000_0001\"","handlingStrategy":"validation","validationCode":"String rid = conf.get(MRJobConfig.RESERVATION_ID); // mapreduce.job.reservation.id\nif (rid != null) {\n  try {\n    ReservationId.parseReservationId(rid); // expects reservation_<ts>_<seq>, both numeric\n  } catch (IOException | NumberFormatException e) {\n    throw new IllegalArgumentException(\"Refusing to submit: bad reservation id: \" + rid, e);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  RunningJob job = jobClient.submitJob(jobConf);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid reservationId:\")) {\n    // re-read the reservation from the ReservationSystem and resubmit\n  }\n  throw e;\n}","preventionTips":["Always propagate the string from ReservationId.toString() instead of hand-formatting IDs","Validate reservation IDs at CLI/service boundaries before they reach job conf","Never leave placeholder values in mapreduce.job.reservation.id; unset the key instead"],"tags":["yarn","reservations","job-submission","configuration","mapreduce"],"backgroundTag":"invalid-configuration-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}