#11818·typeorm

invalidWhereValuesBehavior.undefined set to `throw` is not throwing when is not the only property in `where`

Author: JJBocanegraCreated Dec 3, 2025Updated Sep 17, 2026
Labelsbug

Issue description

invalidWhereValuesBehavior.undefined set to throw is not throwing when is not the only property in where

Expected Behavior

I have an entity A related to entity B, if B entity UUID is undefined it should throw an error.

typescript
a_entity.findOne({
  where: {
    uuid: validUuid,
    b_entity: {
      uuid: undefined,
    },
  },
  relations: {
    b_entity: true,
  },
})

Actual Behavior

It is returning the A entity when it should have thrown an error.

Steps to reproduce

typescript
const dataSource = new DataSource({
    type: "postgres",
    // ...
    invalidWhereValuesBehavior: {
        undefined: 'throw',
        null: 'throw',
    },
});

// 1. a_entity.findOne() - Doesn't work as expected, should throw error but is returning A entity
a_entity.findOne({
  where: {
    uuid: validUuid,
    b_entity: {
      uuid: undefined,
    },
  },
  relations: {
    b_entity: true,
  },
})

// 2. QueryBuilder - Doesn't work as expected, should throw error but is returning A entity
 await this.a_entity.createQueryBuilder('A')
      .innerJoinAndSelect('A.b_entity', 'B')
      .where('A.uuid = :validUuid', { validUuid })
      .andWhere('B.uuid = :bUuid', { bUuid: undefined })
      .getOne()

My Environment

Dependency Version
Operating System macOS 15.7.2
Node.js version 24.4.1
Typescript version 5.9.3
TypeORM version 0.3.27

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.