theonedev/onedev · error · ExplicitException

Field not found (class: ${className}, field: ${fieldName})

Error message

Field not found (class: ${className}, field: ${fieldName})

What it means

ReflectionUtils.setFieldValue walks the class hierarchy via findField and throws ExplicitException when the field cannot be located; the message interpolates the class and field names. This indicates a programming/configuration mismatch, not user input error.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/ReflectionUtils.java:154

			try {
				return current.getDeclaredMethod(methodName, paramTypes);
			} catch (SecurityException e) {
				throw new RuntimeException(e);
			} catch (NoSuchMethodException e) {
				// ignore
			}
			if (current == Object.class)
				break;
			current = current.getSuperclass();
		}
		
		return null;
	}

	public static void setFieldValue(Object object, String fieldName, Object value) {
		Field field = findField(object.getClass(), fieldName);
		if (field == null) {
			throw new ExplicitException("Field not found (class: " + object.getClass().getName() + ", field: " + fieldName + ")");
		}
		field.setAccessible(true);
		try {
			field.set(object, value);
		} catch (IllegalAccessException e) {
			throw ExceptionUtils.unchecked(e);
		}
	}
	
	/**
	 * Find non-static field in specified class hierarchy with specified name.
	 * <p>
	 * @param clazz
	 * 			class to search non-static field in. All the super classes will also 
	 * 			be consulted if not found in sub class
	 * @param fieldName
	 * 			name of the field to search for
	 * @return 

View on GitHub (pinned to d44925c47c)

Solutions

  1. Check the exact field name and target class (inherited fields must exist up the hierarchy).
  2. Use findField and handle a null return when the field is optional.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/util/ReflectionUtils.java:154 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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