theonedev/onedev · error · ValidationException

Missing issue field: ${fieldSpecName}

Error message

Missing issue field: ${fieldSpecName}

What it means

validateFieldNames compares the set of defined field specs with the supplied field names. If a required field spec has no corresponding entry in the supplied map, ValidationException 'Missing issue field: <name>' is thrown.

Source

Thrown at server-core/src/main/java/io/onedev/server/model/support/issue/field/FieldUtils.java:188

		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()) {
			if (entry.getValue() != null) {
				FieldSpec fieldSpec = Preconditions.checkNotNull(fieldSpecMap.get(entry.getKey()));
				validateFieldValue(fieldSpec, entry.getKey(), entry.getValue());
			}
		}
	}
	
	public static void validateFields(Map<String, FieldSpec> fieldSpecs, List<FieldInstance> fields) {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Add the named field to the submitted field map with a valid value
  2. Relax the field's 'required' flag in issue settings if it should be optional
  3. Check field specs of the target project before submission and include all of them

Example fix

// before
fieldMap = Map.of("Priority", List.of("High"));
// after
fieldMap = Map.of("Priority", List.of("High"), "Severity", List.of("Major"));
Defensive patterns

Strategy: validation

Validate before calling

Set<String> specNames = fieldSpecMap.keySet();
Set<String> provided = fieldMap.keySet();
Set<String> missing = new HashSet<>(specNames);
missing.removeAll(provided);
if (!missing.isEmpty()) throw new IllegalStateException("Missing: " + missing);

Try / catch

try {
    FieldUtils.validateFieldMap(fieldSpecMap, fieldMap);
} catch (ValidationException e) {
    if (e.getMessage().startsWith("Missing issue field"))
        fieldMap.put(extractFieldName(e.getMessage()), defaultValue);
}

Prevention

When it happens

Trigger: Submitting an issue field map that omits a mandatory custom field defined for the project, e.g. creating/updating an issue via API or transition without providing a required field.

Common situations: New required fields added to a project after automation scripts were written; form submissions missing fields hidden by condition logic; bulk imports skipping required fields.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/1d33168c4f4e7e9d. Report an issue: GitHub.