Skip to content

Bug with "Copy to locale" on globals #16747

Open

Description

@PeterRygeBestseller

Describe the Bug

When trying to use "copy to locale" on any global i get the following error:

    err: {
      "type": "TypeError",
      "message": "Cannot read properties of undefined (reading 'config')",
      "stack":
          TypeError: Cannot read properties of undefined (reading 'config')
              at copyDataFromLocale (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_@payloadcms_ui_dist_06ysd6i._.js:4679:53)
              at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
              at async copyDataFromLocaleHandler (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_@payloadcms_ui_dist_06ysd6i._.js:4622:16)
              at async executeActionAndPrepareForRender (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:64:5248)
              at async C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:64:1986
              at async handleAction (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:62:25386)
              at async renderToHTMLOrFlightImpl (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:69:55695)
              at async doRender (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:3638:28)
              at async AppPageRouteModule.handleResponse (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:71:66429)
              at async handleResponse (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:3949:32)
              at async Module.handler (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:4355:20)
              at async DevServer.renderToResponseWithComponentsImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1462:9)
              at async DevServer.renderPageComponent (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1514:24)
              at async DevServer.renderToResponseImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1564:32)
              at async DevServer.pipeImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1044:25)
              at async NextNodeServer.handleCatchallRenderRequest (C:\git\payload-test\node_modules\next\dist\server\next-server.js:338:17)
              at async DevServer.handleRequestImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:935:17)
              at async C:\git\payload-test\node_modules\next\dist\server\dev\next-dev-server.js:394:20
              at async Span.traceAsyncFn (C:\git\payload-test\node_modules\next\dist\trace\trace.js:164:20)
              at async DevServer.handleRequest (C:\git\payload-test\node_modules\next\dist\server\dev\next-dev-server.js:390:24)
              at async invokeRender (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:266:21)
              at async handleRequest (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:465:24)
              at async requestHandlerImpl (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:514:13)
              at async Server.requestListener (C:\git\payload-test\node_modules\next\dist\server\lib\start-server.js:225:13)
    }
⨯ TypeError: Cannot read properties of undefined (reading 'config')
    at ignore-listed frames {
  digest: '2467349392'
}
 POST /admin/globals/header?locale=en 500 in 406ms (next.js: 4ms, application-code: 403ms)
  └─ ƒ <inline action>({"args":{"fromLocale":"en","globalSlug":"header","overrideData":true,"...":"1 item not stringified"},"name":"copy-data-from-locale"}) in 28ms src/app/(payload)/layout.tsx

Looks like it might be the same bug or similar to this: #16455

Link to the code that reproduces this issue

https://github.com/PeterRygeBestseller/payload-test/tree/global-copy-to-locale-bug

Reproduction Steps

The linked repository can be used to reproduce the error using a MongoDB database.
Use the global Header to test it.

Which area(s) are affected?

db: mongodb, area: ui, area: core

Environment Info

Binaries:
  Node: 26.2.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.84.1
  next: 16.2.6
  @payloadcms/db-mongodb: 3.84.1
  @payloadcms/email-nodemailer: 3.84.1
  @payloadcms/graphql: 3.84.1
  @payloadcms/next/utilities: 3.84.1
  @payloadcms/payload-cloud: 3.84.1
  @payloadcms/translations: 3.84.1
  @payloadcms/ui/shared: 3.84.1
  react: 19.2.6
  react-dom: 19.2.6
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 IoT Enterprise LTSC 2021
  Available memory (MB): 65461
  Available CPU cores: 24

Activity

  1. added
    status: needs-triage
    validate-reproduction
    on May 26, 2026
  2. added
    area: core
    area: ui
    db: mongodb
    and removed
    validate-reproduction
    on May 26, 2026
  3. sebastijandumancic commented on Jun 2, 2026

    @sebastijandumancic

    I have the same issue right now Payload 3.84.1

  4. christophz commented on Oct 8, 2026

    @christophz

    Also affected on 3.90.2 with @payloadcms/db-postgres (Next 16.4.0, Node 24), so this is not specific to MongoDB.

    Cause, as far as I can see: copyDataFromLocale reads globals[globalSlug].config.fields from req.payload (packages/ui/src/utilities/copyDataFromLocale.ts, around L300 on v3.90.2). But payload.globals is { config: SanitizedGlobalConfig[] }, not a map by slug. Thus globals[globalSlug] is undefined, and the action throws TypeError: Cannot read properties of undefined (reading 'config') before updateGlobal. Nothing is saved.

    The same lookup is in fetchVersions of @payloadcms/next (views/Version): req.payload.globals[globalSlug]?.config. There the optional chaining hides the error, and draftsEnabled is always false for globals in the version view.

    #17072 (against 3.x) fixes both places. #16334 fixes the first one on main. Both are still open.

    Environment (payload info):

    payload, @payloadcms/db-postgres, @payloadcms/ui, @payloadcms/next,
    @payloadcms/richtext-lexical, @payloadcms/translations: 3.90.2
    next 16.4.0, react 19.2.8, node 24.19.0, pnpm 11.25.0, darwin arm64
    

    Minimal config (any localized global; drafts are not necessary):

    localization: { locales: ['en', 'de'], defaultLocale: 'en' },
    globals: [
      { slug: 'landing-page', fields: [{ name: 'title', type: 'text', localized: true }] },
    ],

    Steps: open the global, fill in "Title", then "…" → "Copy to locale" → from en to de → "Copy". The toast shows the error, and the server log has the stack. The same fields in a collection work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPayload OSSarea: corearea: uidb: mongodbstatus: needs-triagev3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions