theonedev/onedev · error · NotAcceptableException
Unrecognized date: ${value}
Error message
Unrecognized date: ${value} What it means
QueryUtils.getDateValue parses a date string using DateUtils.parseRelaxed, which accepts many common formats but not everything. If parsing returns null, a NotAcceptableException 'Unrecognized date' is thrown. This happens when query/criteria values contain date literals in an unsupported format.
Source
Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:121
Project project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
if (project == null)
throw new NotFoundException("Unable to find project '" + projectPath + "'");
return project;
}
public static boolean getBooleanValue(String value) {
if (value.equals("true"))
return true;
else if (value.equals("false"))
return false;
else
throw new NotAcceptableException("Invalid boolean: " + value);
}
public static Date getDateValue(String value) {
Date dateValue = DateUtils.parseRelaxed(value);
if (dateValue == null)
throw new NotAcceptableException("Unrecognized date: " + value);
return dateValue;
}
public static ProjectScopedCommit getCommitId(@Nullable Project project, String value) {
if (project != null && !value.contains(":"))
value = project.getPath() + ":" + value;
ProjectScopedCommit commitId = ProjectScopedCommit.from(value);
if (commitId != null && commitId.getCommitId() != null)
return commitId;
else
throw new NotFoundException("Unable to find revision: " + value);
}
public static ProjectScopedRevision getRevision(@Nullable Project project, String value) {
if (project != null && !value.contains(":"))
value = project.getPath() + ":" + value;
ProjectScopedRevision revision = ProjectScopedRevision.from(value);
if (revision != null)View on GitHub (pinned to d44925c47c)
Solutions
- Use a widely accepted format like ISO 8601: '2026-09-06' or '2026-09-06T12:00:00Z'
- If the query syntax supports relative dates, use supported relative expressions (e.g. '1w ago' style) instead of free-form text
- Pre-validate the string with java.time parsing (LocalDate.parse with a DateTimeFormatter) before calling the utility
- Catch NotAcceptableException and show the supported date formats in the error message
Example fix
// before
Date d = QueryUtils.getDateValue("06.09.2026");
// after
Date d = QueryUtils.getDateValue("2026-09-06"); Defensive patterns
Strategy: validation
Validate before calling
try {
java.time.LocalDate.parse(value);
} catch (java.time.format.DateTimeParseException e) {
throw new UserException("Unsupported date format: " + value + ", use ISO 8601 like 2026-09-06");
} Type guard
boolean isParsableDate(String s) {
return DateUtils.parseRelaxed(s) != null;
} Try / catch
try {
Date d = QueryUtils.getDateValue(value);
} catch (NotAcceptableException e) {
// show supported formats to the user
} Prevention
- Standardize on ISO 8601 dates in queries and configs
- Avoid locale-specific date entry; use a date picker that emits ISO strings
- Test date values with DateUtils.parseRelaxed before persisting them in saved queries
When it happens
Trigger: Calling QueryUtils.getDateValue with a string DateUtils.parseRelaxed cannot interpret — e.g. '2026/13/45' (invalid parts), 'March 3rd', locale-specific formats like '03.03.2026', or epoch milliseconds as a bare number if unsupported.
Common situations: Users typing dates in their locale's format (DD.MM.YYYY vs MM/DD/YYYY); misspelled relative expressions (e.g. 'last week' vs supported relative syntax like '1w'); ISO strings with unexpected timezone suffixes; typos in the date value.
Related errors
- Invalid number: ${value}
- Invalid boolean: ${value}
- State is required
- Issue ${issueReference} is not in current project
- Pull request submitter cannot be reviewer
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/1ed39597dfe910c6.
Report an issue: GitHub.