theonedev/onedev · error · ValidationException
Invalid fields:
Error message
Invalid fields:
What it means
Issue field validation collects errors per field (name -> reason) when populating/applying field values against the project's issue field definitions. If any fields are invalid, a ValidationException listing 'name (reason)' entries is thrown.
Source
Thrown at server-core/src/main/java/io/onedev/server/model/Issue.java:1190
if (field instanceof ChoiceField) {
var choiceField = (ChoiceField) field;
var possibleValues = choiceField.getPossibleValues();
if (field.isAllowMultiple())
invalidFields.put(fieldName, "value must not be empty, and should take one or more of: " + String.join(", ", possibleValues));
else
invalidFields.put(fieldName, "value must not be empty, and should take one of: " + String.join(", ", possibleValues));
} else {
invalidFields.put(fieldName, "value must not be empty");
}
}
}
}
if (invalidFields.size() > 0) {
var fieldErrors = new ArrayList<String>();
for (var entry: invalidFields.entrySet()) {
fieldErrors.add(entry.getKey() + " (" + entry.getValue() + ")");
}
throw new ValidationException("Invalid fields: " + String.join(", ", fieldErrors));
}
} finally {
Project.pop();
}
}
public List<User> getParticipants() {
if (participants == null) {
participants = new LinkedHashSet<>();
participants.add(getSubmitter());
UserService userService = OneDev.getInstance(UserService.class);
for (IssueField field: getFields()) {
if (field.getType().equals(InputSpec.USER)) {
if (field.getValue() != null) {
User user = userService.findByName(field.getValue());
if (user != null)
participants.add(user);
}View on GitHub (pinned to d44925c47c)
Solutions
- Fix the field values/names listed in the exception message to match the project's field definitions
- Define missing custom fields in Project > Issues > Fields
- Update choice fields to use existing option values
- Check required fields and supply values for all of them
Example fix
// before
fields: {"Priority": "Hign", "Env": "prod"} // typo + undefined field
// after
fields: {"Priority": "High"} // 'Env' defined or removed Defensive patterns
Strategy: try-catch
Validate before calling
for (String name : fields.keySet()) { if (issue.getProject().getIssueSetting().getFieldSpec(name) == null) { /* invalid field */ } } Try / catch
try { issue.setFields(fields); } catch (ValidationException e) { reportFieldErrors(e.getMessage()); } Prevention
- Validate field names/values against project field definitions before submit
- Sync scripts after renaming fields/options
- Supply all required field values
When it happens
Trigger: Setting issue fields (API, form, script) where a field name is undefined in the project, a required field is missing, a choice value is not in the field's option list, or a value fails the field's type/validation.
Common situations: API scripts referencing custom fields not defined in the target project; option values renamed in field settings; importing issues from another project with different custom fields; type mismatches (text vs choice).
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
- Title is required
- Issue ${issueReference} is not in current project
- Invalid issue id/number
- Not eligible for multi-value
- Subject required to open issue via email
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/6c20826277cf5941.
Report an issue: GitHub.