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

**URL:** <https://discuss.liferay.com/t/graphql-exceptions-thrown-inside-rest-builder-resources-reach-the-client-with-message-null-invocationtargetexception-not-unwrapped/1067>\
**Category:** Bug Reports\
**Created:** [October 13, 2026, 9:14pm UTC](https://discuss.liferay.com/t/graphql-exceptions-thrown-inside-rest-builder-resources-reach-the-client-with-message-null-invocationtargetexception-not-unwrapped/1067 "2026-10-13T21:14:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Vieira\_Dutra](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/bruno_vieira_dutra/32/905_2.png) [@Bruno\_Vieira\_Dutra](https://discuss.liferay.com/u/Bruno_Vieira_Dutra)\
**Post date:** [October 13, 2026, 9:14pm UTC](https://discuss.liferay.com/t/graphql-exceptions-thrown-inside-rest-builder-resources-reach-the-client-with-message-null-invocationtargetexception-not-unwrapped/1067/1 "2026-10-13T21:14:53Z")

</div>

**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`:

```graphql
query {
  headlessAdminListType_v1_0 {
    listTypeDefinition(listTypeDefinitionId: 999999) { id }
  }
}

```

1. Send this mutation, which fails a service-layer validation:

```graphql
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**
>
> ```auto
> 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**
>
> ```auto
> 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)

```diff
+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.
