payloadcms/payload · error · Error
Error fetching data from locale "${fromLocale}"
Error message
Error fetching data from locale "${fromLocale}" What it means
Thrown after copyDataFromLocale runs its two locale reads through Promise.allSettled; the SOURCE-locale fetch (findByID for a collection, or findGlobal) was rejected. This message is a wrapper - the real underlying error lives in `fromLocaleData.reason` (DB error, access denial, not-found, bad locale code) and is logged server-side but not surfaced in the message.
Source
Thrown at packages/ui/src/utilities/copyDataFromLocale.ts:294
overrideAccess: false,
user,
// `select` would allow us to select only the fields we need in the future
})
: payload.findByID({
id: docID,
collection: collectionSlug,
depth: 0,
draft: true,
joins: false,
locale: toLocale,
overrideAccess: false,
user,
// `select` would allow us to select only the fields we need in the future
}),
])
if (fromLocaleData.status === 'rejected') {
throw new Error(`Error fetching data from locale "${fromLocale}"`)
}
if (toLocaleData.status === 'rejected') {
throw new Error(`Error fetching data from locale "${toLocale}"`)
}
const fields = globalSlug
? globals[globalSlug].config.fields
: collections[collectionSlug].config.fields
const fromLocaleDataWithoutID = fromLocaleData.value
const toLocaleDataWithoutID = toLocaleData.value
const dataWithID = overrideData
? fromLocaleDataWithoutID
: mergeData(fromLocaleDataWithoutID, toLocaleDataWithoutID, fields, req, false)
const data = removeIdIfParentIsLocalized(dataWithID, fields)View on GitHub (pinned to 00c58b35c0)
Solutions
- Confirm `fromLocale` is listed in `payload.config.localization.locales` and the collection/global is localized.
- Verify the user has read access to the document in `fromLocale`.
- Inspect the server logs for `fromLocaleData.reason` to find the true underlying error (DB, access, not-found).
- Ensure the document exists and has a draft in the source locale before invoking copy.
- Retry the copy action after resolving transient DB issues.
Defensive patterns
Strategy: try-catch
Validate before calling
const configuredLocales =
(req.payload.config.localization?.locales ?? []).map((l) => l.code)
if (!configuredLocales.includes(fromLocale)) {
// abort before calling copyDataFromLocale: source locale not configured
}
// optional: confirm the doc has a draft in fromLocale
const exists = await payload.findByID({
id: docID,
collection: collectionSlug,
depth: 0,
draft: true,
locale: fromLocale,
overrideAccess: false,
user,
}).catch(() => null)
if (!exists) {
// abort: nothing to copy from this locale
} Type guard
function isConfiguredLocale(
code: string,
config: { localization?: { locales: Array<{ code: string }> } },
): boolean {
return (config.localization?.locales ?? []).some((l) => l.code === code)
} Try / catch
try {
await copyDataFromLocale(args)
} catch (err) {
if (err instanceof Error && err.message.startsWith('Error fetching data from locale')) {
// surface a user-facing message; the real reason is in the server logs
} else {
throw err
}
} Prevention
- Gate the copy-locale UI by the configured locale list.
- Log `fromLocaleData.reason` server-side so the root cause (access/DB/not-found) is diagnosable.
- Confirm the source document has a draft in `fromLocale` before enabling the action.
- Retry transient DB failures via the admin action after resolving the underlying issue.
When it happens
Trigger: `fromLocale` is not in config.localization.locales; the collection/global is not localized; the document has no draft in that locale; the user lacks read access; the docID does not exist; a transient DB error during the admin copy action.
Common situations: Requesting a locale that was removed from config, copying from a locale whose draft was never created, restricted access policies on the source locale, transient DB/connectivity outage during the copy-locale admin action.
Related errors
- Error fetching data from locale "${toLocale}"
- Either collectionSlug or globalSlug must be provided
- Cannot provide both collectionSlug and globalSlug
- Localization is not enabled in payload config
- ${collectionSlug ? 'Collection' : 'Global'} not found: ${col
AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12).
Data as JSON: /api/errors/b666e5cb3b152fbf.
Report an issue: GitHub.