theonedev/onedev · error · ValidationException

Unknown issue field: ${fieldName}

Error message

Unknown issue field: ${fieldName}

What it means

validateFieldNames also checks the reverse direction: any supplied field name that has no matching field spec causes ValidationException 'Unknown issue field: <name>'. This guards against typos and fields from other projects.

Source

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

			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) {
		Map<String, List<String>> fieldMap = new HashMap<>();
		for (FieldInstance field: fields) {
			List<String> values;
			if (field.getValueProvider() instanceof SpecifiedValue)

View on GitHub (pinned to d44925c47c)

Solutions

  1. Remove or rename the offending key in the field map to match a defined field spec
  2. Define the field in the project's issue settings if it should exist
  3. List valid specs via issueSetting.getFieldSpecs() before building the map

Example fix

// before
fieldMap.put("prority", List.of("High")); // typo
// after
fieldMap.put("Priority", List.of("High"));
Defensive patterns

Strategy: validation

Validate before calling

Set<String> unknown = new HashSet<>(fieldMap.keySet());
unknown.removeAll(fieldSpecMap.keySet());
if (!unknown.isEmpty()) throw new IllegalStateException("Unknown fields: " + unknown);

Try / catch

try {
    FieldUtils.validateFieldMap(fieldSpecMap, fieldMap);
} catch (ValidationException e) {
    if (e.getMessage().startsWith("Unknown issue field"))
        fieldMap.keySet().removeIf(n -> !fieldSpecMap.containsKey(n));
}

Prevention

When it happens

Trigger: Passing a field name in the field map that is not defined in the project's issue settings, e.g. misspelled names or fields copied from another project.

Common situations: Renamed custom fields with scripts still using old names; cross-project issue moves carrying fields that don't exist in the destination project.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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