junit-team/junit5 · error · JUnitException

Detected cycle in inner class hierarchy between %s and %s

Error message

Detected cycle in inner class hierarchy between %s and %s

What it means

Error "Detected cycle in inner class hierarchy between %s and %s" thrown in junit-team/junit5.

Source

Thrown at junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java:2022

	 * exception}; otherwise, this method returns the supplied {@code Throwable}.
	 */
	static Throwable getUnderlyingCause(Throwable t) {
		if (t instanceof InvocationTargetException ite) {
			return getUnderlyingCause(ite.getTargetException());
		}
		return t;
	}

	/**
	 * @since 1.13.2
	 */
	@API(status = INTERNAL, since = "1.13.2")
	public enum CycleErrorHandling {

		THROW_EXCEPTION {
			@Override
			void handle(Class<?> clazz, Class<?> enclosing) {
				throw new JUnitException("Detected cycle in inner class hierarchy between %s and %s".formatted(
					clazz.getName(), enclosing.getName()));
			}
		},

		ABORT_VISIT {
			@Override
			void handle(Class<?> clazz, Class<?> enclosing) {
				// ignore
			}
		};

		abstract void handle(Class<?> clazz, Class<?> enclosing);
	}

}

View on GitHub (pinned to 956246301e)

When it happens

Trigger: Thrown at junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java:2022 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04). Data as JSON: /data/errors/af6ac804731850da.json. Report an issue: GitHub.