theonedev/onedev · error · ValidationException
Error validating value
Error message
Error validating value '${displayValue}' of field '${fieldName}': ${message} What it means
validateFieldValue catches exceptions thrown while validating a single issue field value and rethrows a ValidationException that includes the field name, the display value, and the underlying message. It indicates the supplied value failed the field spec's validation (choice options, date format, etc.).
Solutions
- Read the embedded ${message} for the concrete validation reason and fix the value accordingly
- For choice fields, use one of the exact option values defined in the field spec
- Validate values with fieldSpec.convertToObject() locally before submitting
Example fix
// before
fieldMap.put("Priority", List.of("very-high")); // not an option
// after
fieldMap.put("Priority", List.of("High")); // exact option name from field spec Defensive patterns
Strategy: validation
Validate before calling
Object converted = fieldSpec.convertToObject(raw); fieldSpec.validate(converted); // throws early with detailed message
Try / catch
try {
FieldUtils.validateFieldMap(fieldSpecMap, fieldMap);
} catch (ValidationException e) {
showErrorToUser(e.getMessage()); // already contains field, value and reason
} Prevention
- Fetch option lists from the field spec rather than hardcoding values
- Validate values client-side with fieldSpec.convertToObject before submitting
- Sync field definitions when copying issues between projects
When it happens
Trigger: Calling validateFieldMap/validateFields with a value that fails FieldSpec validation, e.g. a choice field value not in the option list, an invalid date string, or a malformed number; secret fields show MASK as display value.
Common situations: REST API issue creation with wrong custom field values; scripts copying values between projects whose field definitions differ; users typing free text into choice fields.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Duplicate field
- Error validating issue fields:
- Missing issue field
- Unknown issue field
- Account name needs to be specified to generate refresh token
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/aea99302d5de0dad.
Report an issue: GitHub.
Appendix: source
Thrown at server-core/src/main/java/io/onedev/server/model/support/issue/field/FieldUtils.java:180
} finally {
HierarchicalContext.pop();
}
}
return fieldValues;
}
private static void validateFieldValue(FieldSpec fieldSpec, String fieldName, List<String> fieldValue) {
try {
fieldSpec.convertToObject(fieldValue);
} catch (Exception e) {
String displayValue;
if (fieldSpec instanceof SecretField)
displayValue = SecretInput.MASK;
else
displayValue = fieldValue.toString();
if (e.getMessage() == null)
logger.error("Error validating field value", e);
throw new ValidationException("Error validating value '" + displayValue + "' of field '"
+ fieldName + "': " + e.getMessage());
}
}
private static void validateFieldNames(Collection<String> fieldSpecNames, Collection<String> fieldNames) {
for (String fieldSpecName: fieldSpecNames) {
if (!fieldNames.contains(fieldSpecName))
throw new ValidationException("Missing issue field: " + fieldSpecName);
}
for (String fieldName: fieldNames) {
if (!fieldSpecNames.contains(fieldName))
throw new ValidationException("Unknown issue field: " + fieldName);
}
}
public static void validateFieldMap(Map<String, FieldSpec> fieldSpecMap, Map<String, List<String>> fieldMap) {
validateFieldNames(fieldSpecMap.keySet(), fieldMap.keySet());
for (Map.Entry<String, List<String>> entry: fieldMap.entrySet()) {View on GitHub (pinned to d44925c47c)