payloadcms/payload · error · APIError
ERROR: Failed to retrieve global version model with the slug
Error message
ERROR: Failed to retrieve global version model with the slug "${globalSlug}". Does not exist. What it means
Thrown by `getGlobal` when `versions: true` is requested but `adapter.versions[globalSlug]` is undefined — the global versions model was never built. The global either does not have versions enabled, or the model build was skipped/raced.
Source
Thrown at packages/db-mongodb/src/utilities/getEntity.ts:82
globalConfig: SanitizedGlobalConfig
Model: CollectionModel
}
}
export const getGlobal: GetGlobal = ({ adapter, globalSlug, versions = false }) => {
const globalConfig = adapter.payload.config.globals.find((each) => each.slug === globalSlug)
if (!globalConfig) {
throw new APIError(
`ERROR: Failed to retrieve global with the slug "${globalSlug}". Does not exist.`,
)
}
if (versions) {
const Model = adapter.versions[globalSlug]
if (!Model) {
throw new APIError(
`ERROR: Failed to retrieve global version model with the slug "${globalSlug}". Does not exist.`,
)
}
return { globalConfig, Model }
}
return { globalConfig, Model: adapter.globals } as any
}
View on GitHub (pinned to 00c58b35c0)
Solutions
- Enable `versions: true` on the global config.
- Restart the process to rebuild versions models.
- Await `payload.init()` before calling versions APIs.
- If versions aren't enabled, use the non-versions global API.
Example fix
// before
{ slug: 'navigation', versions: false }
await payload.findGlobalVersions({ slug: 'navigation' })
// after
{ slug: 'navigation', versions: { drafts: true } }
await payload.findGlobalVersions({ slug: 'navigation' }) Defensive patterns
Strategy: validation
Validate before calling
function assertGlobalVersions(payload, slug) {
const enabled = payload.config.globals.find(g => g.slug === slug)?.versions
if (!enabled) throw new Error(`Versions not enabled on global ${slug}`)
} Type guard
const globalHasVersions = (payload, s) => Boolean(payload.config.globals.find(g => g.slug === s)?.versions)
Try / catch
try { await payload.findGlobalVersions({ slug }) }
catch (e) { if (/global version model with the slug/.test(e.message)) enableGlobalVersions(slug) else throw e } Prevention
- Enable versions on globals you call versions APIs on.
- Restart after enabling versions so models rebuild.
- Use the non-versions global API when versions aren't enabled.
When it happens
Trigger: Calling a versions-aware global operation (`findGlobalVersions`, etc.) on a global whose config does not have `versions: true`, or before the versions models were built.
Common situations: `versions` not enabled on the global; config changed but process not restarted; init race.
Related errors
- Global with the slug ${globalSlug} was not found
- ERROR: Failed to retrieve collection version model with the
- ERROR: Failed to retrieve global with the slug "${globalSlug
- The global with slug ${String(globalSlug)} can't be found.
- The global with slug ${String(globalSlug)} can't be found.
AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12).
Data as JSON: /api/errors/ae3091d05d514c99.
Report an issue: GitHub.