apache/hadoop · warning · BadRequestException
startedTimeEnd must be greater than startTimeBegin
Error message
startedTimeEnd must be greater than startTimeBegin
What it means
Thrown by the JobHistoryServer REST API (HsWebServices.getJobs) when both startedTimeBegin and startedTimeEnd are supplied and startedTimeBegin > startedTimeEnd. The window filter requires the start-time range to be well ordered; otherwise the request fails with HTTP 400. Note the message contains a historical typo ('startTimeBegin' vs the actual parameter 'startedTimeBegin') — search for the parameter names, not the message, in docs.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsWebServices.java:229
}
if (sBegin < 0) {
throw new BadRequestException("startedTimeBegin must be greater than 0");
}
}
Long sEnd = null;
if (startedEnd != null && !startedEnd.isEmpty()) {
try {
sEnd = Long.parseLong(startedEnd);
} catch (NumberFormatException e) {
throw new BadRequestException("Invalid number format: " + e.getMessage());
}
if (sEnd < 0) {
throw new BadRequestException("startedTimeEnd must be greater than 0");
}
}
if (sBegin != null && sEnd != null && sBegin > sEnd) {
throw new BadRequestException(
"startedTimeEnd must be greater than startTimeBegin");
}
Long fBegin = null;
if (finishBegin != null && !finishBegin.isEmpty()) {
try {
fBegin = Long.parseLong(finishBegin);
} catch (NumberFormatException e) {
throw new BadRequestException("Invalid number format: " + e.getMessage());
}
if (fBegin < 0) {
throw new BadRequestException("finishedTimeBegin must be greater than 0");
}
}
Long fEnd = null;
if (finishEnd != null && !finishEnd.isEmpty()) {
try {
fEnd = Long.parseLong(finishEnd);View on GitHub (pinned to 2add963021)
Solutions
- Swap the two values so startedTimeBegin <= startedTimeEnd
- Regenerate both bounds from the same instant: begin = now - window, end = now
- Validate the ordering in your client before issuing the request
Example fix
// before String url = base + "?startedTimeBegin=" + end + "&startedTimeEnd=" + begin; // after String url = base + "?startedTimeBegin=" + begin + "&startedTimeEnd=" + end; assert begin <= end;
Defensive patterns
Strategy: validation
Validate before calling
if (begin != null && end != null && begin > end) {
long t = begin; begin = end; end = t; // or reject with a clear client-side error
} Try / catch
// if calling via a generic HTTP client
try { resp = get(url); }
catch (BadRequestException e) {
if (e.getMessage().contains("startedTimeEnd must be greater"))
throw new IllegalArgumentException("inverted started-time window", e);
} Prevention
- Assert begin <= end for every time-window pair before building the URL
- Generate both bounds from one base instant (now-window, now)
- Remember equality is allowed; only strict inversion fails
When it happens
Trigger: GET /ws/v1/history/mapreduce/jobs?startedTimeBegin=1700000000000&startedTimeEnd=1699999999000 — any call where the begin value is strictly greater than the end value (equality is allowed).
Common situations: Swapped begin/end arguments when building the URL; Client computes end relative to a different clock source (local vs server) producing an inverted window; Copy-paste from an example with dates in the wrong order
Related errors
- startedTimeEnd must be greater than 0
- finishedTimeBegin must be greater than 0
- finishedTimeEnd must be greater than 0
- finishedTimeEnd must be greater than finishedTimeBegin
- tasktype must be either m or r
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/18843919e4c73d80.
Report an issue: GitHub.