{"record":{"id":"773acb547d5afe07","repo":"payloadcms/payload","slug":"the-global-with-slug-string-globalslug-can-t-b-773acb","errorCode":null,"errorMessage":"The global with slug ${String(globalSlug)} can't be found.","messagePattern":"The global with slug (.+?) can't be found\\.","errorType":"http","errorClass":"APIError","httpStatus":500,"severity":"error","filePath":"packages/payload/src/globals/operations/local/restoreVersion.ts","lineNumber":73,"sourceCode":"   * the Global slug to operate against.\n   */\n  slug: TSlug\n  /**\n   * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n   */\n  user?: null | User\n}\n\nexport async function restoreGlobalVersionLocal<TSlug extends GlobalSlug>(\n  payload: Payload,\n  options: Options<TSlug>,\n): Promise<DataFromGlobalSlug<TSlug>> {\n  const { id, slug: globalSlug, depth, overrideAccess = true, populate, showHiddenFields } = options\n\n  const globalConfig = payload.globals.config.find((config) => config.slug === globalSlug)\n\n  if (!globalConfig) {\n    throw new APIError(`The global with slug ${String(globalSlug)} can't be found.`)\n  }\n\n  return restoreVersionOperation({\n    id,\n    depth,\n    globalConfig,\n    overrideAccess,\n    populate,\n    req: await createLocalReq(options as CreateLocalReqOptions, payload),\n    showHiddenFields,\n  })\n}\n","sourceCodeStart":55,"sourceCodeEnd":86,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/payload/src/globals/operations/local/restoreVersion.ts#L55-L86","documentation":"Thrown by restoreGlobalVersionLocal (payload.restoreGlobalVersion) when globalSlug is not registered. Guard before delegating to restoreVersionOperation.","triggerScenarios":"Calling payload.restoreGlobalVersion({ id, slug: 'unknown' }) with a slug absent from payload.globals.config.","commonSituations":"Slug typo; renamed global; restoring from a script with a hardcoded stale slug; calling before init.","solutions":["Validate the slug against payload.globals.config before calling.","Use typed GlobalSlug constants for restore scripts.","After a rename, sweep all restore call sites.","Confirm versions are enabled on the target global."],"exampleFix":"// before\nawait payload.restoreGlobalVersion({ slug: 'configg', id })\n\n// after\nif (!payload.globals.config.some(g => g.slug === slug)) {\n  throw new Error(`Unknown global slug: ${slug}`)\n}\nawait payload.restoreGlobalVersion({ slug, id })","handlingStrategy":"validation","validationCode":"if (!payload.globals.config.some((g) => g.slug === slug)) {\n  throw new Error(`Unknown global: ${slug}`)\n}","typeGuard":"function isGlobalSlug(payload: Payload, slug: string): slug is GlobalSlug {\n  return payload.globals.config.some((g) => g.slug === slug)\n}","tryCatchPattern":"try {\n  await payload.restoreGlobalVersion({ slug, id })\n} catch (err) {\n  if (err instanceof APIError && /can't be found/.test(err.message)) return null\n  throw err\n}","preventionTips":["Hardcode restore slugs as typed GlobalSlug constants.","Confirm versions are enabled before exposing restore in the UI."],"tags":["globals","versions","local-api","config","validation"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}