apache/hadoop · error · RuntimeException
Bad Request: Missing job ID
Error message
Bad Request: Missing job ID
What it means
AppController.requireJob guards every job-scoped page of the AM web UI: when the 'job.id' query parameter is missing or empty it sends a 400 (badRequest) and throws RuntimeException("Bad Request: Missing job ID") to abort rendering.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java:412
boolean checkAccess(Job job) {
String remoteUser = request().getRemoteUser();
UserGroupInformation callerUGI = null;
if (remoteUser != null) {
callerUGI = UserGroupInformation.createRemoteUser(remoteUser);
}
if (callerUGI != null && !job.checkAccess(callerUGI, JobACL.VIEW_JOB)) {
return false;
}
return true;
}
/**
* Ensure that a JOB_ID was passed into the page.
*/
public void requireJob() {
if ($(JOB_ID).isEmpty()) {
badRequest("missing job ID");
throw new RuntimeException("Bad Request: Missing job ID");
}
JobId jobID = MRApps.toJobID($(JOB_ID));
app.setJob(app.context.getJob(jobID));
if (app.getJob() == null) {
notFound($(JOB_ID));
throw new RuntimeException("Not Found: " + $(JOB_ID));
}
/* check for acl access */
Job job = app.context.getJob(jobID);
if (!checkAccess(job)) {
accessDenied("User " + request().getRemoteUser() + " does not have " +
" permission to view job " + $(JOB_ID));
throw new RuntimeException("Access denied: User " +
request().getRemoteUser() + " does not have permission to view job " +
$(JOB_ID));
}View on GitHub (pinned to 2add963021)
Solutions
- Append the parameter: /job?job.id=job_1401318629735_0001
- Start at the AM home page and follow the application master link - generated URLs always carry job.id
- Check for URL-encoding mistakes that empty the value
Example fix
// before http://am-host:8099/job // 400 Bad Request: Missing job ID // after http://am-host:8099/job?job.id=job_1401318629735_0001
Defensive patterns
Strategy: validation
Validate before calling
if (jobId == null || jobId.isEmpty() || !jobId.startsWith("job_")) {
throw new IllegalArgumentException("job.id query parameter is required: ?job.id=job_<ts>_<seq>");
}
String url = "http://" + amHost + ":8099/job?job.id=" + URLEncoder.encode(jobId, UTF_8); Type guard
static boolean isWellFormedJobId(String jid) {
return jid != null && jid.startsWith("job_")
&& jid.split("_").length == 3;
} Prevention
- Centralize AM UI URL construction in one helper that always appends job.id
- Test scraping links end-to-end so dropped parameters fail in CI
- Enter through the AM home page and follow its links
When it happens
Trigger: Opening /job, /tasks, /attempts, /task, /conf or /counters on the AM UI without ?job.id=job_..., or with an empty value (?job.id=).
Common situations: Bookmarked page whose query string was cut off; templating or scraping code that drops the parameter; manual URL construction.
Related errors
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/103685f0ee3cc244.
Report an issue: GitHub.