diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts index 0b867baae79..8e6a7a6eaae 100644 --- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts +++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-parsers/graphql-query-filter/graphql-query-filter-field.parser.ts @@ -69,6 +69,17 @@ export class GraphqlQueryFilterFieldParser { useDirectTableReference, ); } + + if (!isDefined(filterValue)) { + throw new GraphqlQueryRunnerException( + `Invalid filter value for field "${key}". Use { is: "NULL" } or { is: "NOT_NULL" } to filter on null values`, + GraphqlQueryRunnerExceptionCode.INVALID_QUERY_INPUT, + { + userFriendlyMessage: msg`Invalid filter value for field "${key}". Use { is: "NULL" } to filter on null values`, + }, + ); + } + const [[operator, value]] = Object.entries(filterValue); if (