WhereBuilder throws "Cannot read properties of undefined (reading 'value')" when the list URL filters on a field that is not filterable
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- next.js, react, typescript
Research direction
Start with packages/ui/src/elements/WhereBuilder/Condition/index.tsx and packages/ui/src/elements/WhereBuilder/index.tsx, where the issue traces the undefined field and the unguarded field.value access. Reproduce with a where URL that names a nonexistent or unreadable field, then inspect nearby tests for filter conditions. Done means the filter row still renders and loading that URL raises no unhandled rejection.
Written by the indexing model from the issue text.
Description
Describe the Bug
Opening a collection list view whose URL where query references a path that is not among the filterable fields causes an unhandled promise rejection about 300ms after the filters render:
TypeError: Cannot read properties of undefined (reading 'value')
at WhereBuilder.useCallback[updateCondition] (packages/ui/src/elements/WhereBuilder/index.tsx)
at Condition.useEffectEvent[updateValue] (packages/ui/src/elements/WhereBuilder/Condition/index.tsx)
at Condition.useEffect
The filter row itself renders fine (empty field select). Nothing breaks visually, but every such page load raises an unhandled rejection. In dev, Next.js shows "1 Issue". In production it reaches error monitoring as an unhandledrejection. We found it in production through Grafana Faro on /admin/collections/posts/.
Realistic ways to get there:
- A shared or bookmarked list URL that filters on a field that was later renamed or removed.
- A shared list URL that filters on a field the current user cannot read. Since #14118,
reduceFieldsToOptionsdrops fields without read access from the filter options.
Cause: Condition resolves its field with reducedFields.find((field) => field.value === fieldPath), which is undefined for these paths. Its debounced value effect still calls updateCondition({ type: 'value', field: reducedField, ... }) on mount. updateCondition then reads field.value without a guard, inside an async callback, so the rejection is unhandled.
The same trigger (pasting a filtered list URL) crashed at a different spot in #9179, fixed in #9276. On main this is already guarded (field?.fieldPath, from #16810), so it only affects 3.x.
Link to the code that reproduces this issue
https://github.com/paurushrai/payload-wherebuilder-unknown-field
Reproduction Steps
- Clone the repo above (stock
[email protected] -t blank, SQLite). The only change:Usershas a field withaccess: { read: () => false }. cp .env.example .envand setPAYLOAD_SECRET.npm install && npm run dev, then open http://localhost:3000/admin and create the first user.- Open either URL:
- http://localhost:3000/admin/collections/users?where[or][0][and][0][internalNote][equals]=x (field the user cannot read)
- http://localhost:3000/admin/collections/users?where[or][0][and][0][doesNotExist][equals]=x (field that does not exist)
- Open the browser console. About 300ms after load:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'value').
Expected: the row renders and nothing throws.
Which area(s) are affected?
area: ui
Environment Info
Binaries:
Node: 24.18.0
npm: 11.16.0
pnpm: 11.28.6
Relevant Packages:
payload: 3.92.0
next: 16.3.3
@payloadcms/db-sqlite: 3.92.0
@payloadcms/ui/shared: 3.92.0
react: 19.2.6
react-dom: 19.2.6
Operating System:
Platform: darwin
Arch: arm64
Also seen on payload 3.85.2 with @payloadcms/db-postgres, Next 16.2.10, in production.
- Dominant language
- TypeScript
- Stars
- 45.5k
- Forks
- 4.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 299
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
Regression: `findByID` with `disableErrors: true` throws `NotFound` for null/empty ids since 3.91.0Possibly taken @Krrishkumar125 claimed this 4 days ago. Openarea: core Bug invalid-reproduction status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18935 · 1 comment ·
Maintainers usually reply within 1 day
-
bug: Local API call with req resets req.fallbackLocale to defaultLocalePossibly taken A pull request linked to this issue is open or already merged. Openarea: core Bug created-by: Contributor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#18768 ·
Maintainers usually reply within 1 day
-
[plugin-multi-tenant] Infinite redirect loop with custom tenantFieldName and isGlobal collectionsPossibly taken A pull request linked to this issue is open or already merged. OpenBug plugin: multi-tenant status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18690 ·
Maintainers usually reply within 1 day
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Possibly taken @PINYOPATTANAWASANPORN claimed this 12 days ago. Openarea: core Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18674 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
db-postgres: connect() rejects its `initializing` promise with no argument, producing an unhandledRejection with reason `undefined`Possibly taken @Metehan-Bicer claimed this 15 days ago. Openarea: db-postgres Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18656 · 1 comment ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Japan Fact 898 (good-first-issue)Opencommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 86/100
lingdojo/kana-dojo#33145 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
code-yeongyu/senpi#4278 ·
Maintainers usually reply within 1 day
-
[Bug] Activity | The activity list ignores taskIds and returns the activities of every taskPossibly taken @NdekoCode claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ever-co/ever-gauzy#11469 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
griffinwork40/agent-afk#4408 ·
Maintainers usually reply within 1 day