GraphQL: exceptions thrown inside REST Builder resources reach the client with message "null" (InvocationTargetException not unwrapped)

Affected versions

  • Reproduced at runtime: Liferay Portal 7.4 GA129 (liferay-portal-tomcat-7.4.3.129-ga129, com.liferay.portal.vulcan.impl 5.0.128).
  • Same code path, checked in source on 2026-10-13: 7.4 GA132, DXP 2026.Q1.0, DXP 2026.Q3.0 and master.
  • Worked correctly in 7.4 GA15.

Problem overview

Any exception thrown inside a REST Builder *ResourceImpl method and called through /o/graphql reaches the client as Exception while fetching data (/path) : null. The original message is lost, so GraphQL clients cannot show validation or business errors to users.

Steps to reproduce

  1. Start a clean Liferay Portal 7.4 GA129 bundle.
  2. Authenticated as an administrator, send to /o/graphql:
query {
  headlessAdminListType_v1_0 {
    listTypeDefinition(listTypeDefinitionId: 999999) { id }
  }
}
  1. Send this mutation, which fails a service-layer validation:
mutation {
  headlessAdminListType_v1_0 {
    createListTypeDefinition(listTypeDefinition: {name_i18n: {en_US: ""}}) { id }
  }
}
  1. Optionally set the logger com.liferay.portal.vulcan.internal.graphql.data.fetcher.BaseDataFetcher to WARN to see the underlying exception.

Expected results

  • Exception while fetching data (/headlessAdminListType_v1_0/listTypeDefinition) : No ListTypeDefinition exists with the primary key 999999
  • Exception while fetching data (/headlessAdminListType_v1_0/createListTypeDefinition) : Name is null for locale English (United States)

Actual results

  • Exception while fetching data (/headlessAdminListType_v1_0/listTypeDefinition) : null (code 404)
  • Exception while fetching data (/headlessAdminListType_v1_0/createListTypeDefinition) : null (code 500)
Server log, step 2
java.lang.reflect.InvocationTargetException: null
	at java.lang.reflect.Method.invoke(Method.java:580)
	at com.liferay.portal.vulcan.internal.graphql.data.processor.LiferayMethodDataFetchingProcessor.process(LiferayMethodDataFetchingProcessor.java:309)
	at com.liferay.portal.vulcan.internal.graphql.data.fetcher.LiferayMethodDataFetcher.get(LiferayMethodDataFetcher.java:50)
	at com.liferay.portal.vulcan.internal.graphql.data.fetcher.BaseDataFetcher.get(BaseDataFetcher.java:47)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:279)
	...
Caused by: com.liferay.list.type.exception.NoSuchListTypeDefinitionException: No ListTypeDefinition exists with the primary key 999999
Server log, step 3
java.lang.reflect.InvocationTargetException: null
	at java.lang.reflect.Method.invoke(Method.java:580)
	at com.liferay.portal.vulcan.internal.graphql.data.processor.LiferayMethodDataFetchingProcessor.process(LiferayMethodDataFetchingProcessor.java:309)
	...
Caused by: com.liferay.list.type.exception.ListTypeDefinitionNameException: Name is null for locale English (United States)

Root cause

In GA15, the data fetcher inside GraphQLServletExtender unwrapped the reflection exception (throw new RuntimeException(invocationTargetException.getTargetException())). After the logic moved to LiferayMethodDataFetcher / BaseDataFetcher / LiferayMethodDataFetchingProcessor, process() calls method.invoke(instance, argumentArray) and the InvocationTargetException propagates unchanged. graphql-java builds the error text in ExceptionWhileDataFetching from exception.getMessage(), which is always null for an InvocationTargetException.

LiferayGraphQLErrorHandler._getThrowable() already unwraps it, but only to classify the error (Forbidden / Not Found); the message still comes from graphQLError.getMessage().

Suggested fix (applies to current master)

+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@
-		return _liferayMethodDataFetchingProcessor.process(
-			dataFetchingEnvironment.getArguments(),
-			graphQLFieldDefinition.getName(), httpServletRequest,
-			httpServletResponse, _method, dataFetchingEnvironment.getRoot(),
-			dataFetchingEnvironment.getSource());
+		try {
+			return _liferayMethodDataFetchingProcessor.process(
+				dataFetchingEnvironment.getArguments(),
+				graphQLFieldDefinition.getName(), httpServletRequest,
+				httpServletResponse, _method, dataFetchingEnvironment.getRoot(),
+				dataFetchingEnvironment.getSource());
+		}
+		catch (InvocationTargetException invocationTargetException) {
+			Throwable cause = invocationTargetException.getCause();
+
+			if (cause instanceof Exception) {
+				throw (Exception)cause;
+			}
+
+			throw invocationTargetException;
+		}

Verification

On a clean GA129 bundle we replaced only LiferayMethodDataFetcher in com.liferay.portal.vulcan.impl with this change. The same two requests then returned ... : No ListTypeDefinition exists with the primary key 999999 and ... : Name is null for locale English (United States). The HTTP-like code in the error extensions did not change (404 and 500).

We are happy to open a pull request or test a fix on a newer release.