payloadcms / payloadcms/payload
Setting upload.safeFileNames to a RegExp causes runtime error
Open
@paulpopus is already working on this.
Since Feb 24, 2026.
area: core
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
I have set upload.safeFileNames to a RegExp object in payload.config.ts, and when trying to open /admin in the browser, a runtime error occurs:
⨯ Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
{safeFileNames: RegExp, adapters: []}
^^^^^^
at stringify (<anonymous>) {
digest: '2619984431'
}
Link to the code that reproduces this issue
https://github.com/Shayan-To/payload-repro/tree/repro-1
Reproduction Steps
Checkout the project in branch repro-1. Start the dev server (pnpm run dev). Go to /admin in the browser. See the error.
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 24.11.1
npm: 8.19.4
Yarn: 4.12.0
pnpm: 10.28.2
Relevant Packages:
payload: 3.77.0
next: 15.4.11
@payloadcms/db-sqlite: 3.77.0
@payloadcms/drizzle: 3.77.0
@payloadcms/graphql: 3.77.0
@payloadcms/next/utilities: 3.77.0
@payloadcms/richtext-lexical: 3.77.0
@payloadcms/translations: 3.77.0
@payloadcms/ui/shared: 3.77.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 65421
Available CPU cores: 4
Contributor 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.
Assessment
This issue has not been assessed yet.