{"record":{"id":"73e401b77d78c449","repo":"payloadcms/payload","slug":"the-global-with-slug-string-globalslug-can-t-b-73e401","errorCode":null,"errorMessage":"The global with slug ${String(globalSlug)} can't be found.","messagePattern":"The global with slug (.+?) can't be found\\.","errorType":"exception","errorClass":"APIError","httpStatus":500,"severity":"error","filePath":"packages/payload/src/globals/operations/local/findOne.ts","lineNumber":121,"sourceCode":"): Promise<TransformGlobalWithSelect<TSlug, TSelect>> {\n  const {\n    slug: globalSlug,\n    data,\n    depth,\n    disableErrors,\n    draft = false,\n    flattenLocales,\n    includeLockStatus,\n    overrideAccess = true,\n    populate,\n    select,\n    showHiddenFields,\n  } = 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 findOneOperation({\n    slug: globalSlug as string,\n    data,\n    depth,\n    disableErrors,\n    draft,\n    flattenLocales,\n    globalConfig,\n    includeLockStatus,\n    overrideAccess,\n    populate,\n    req: await createLocalReq(options as CreateLocalReqOptions, payload),\n    select,\n    showHiddenFields,\n  })\n}","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/payload/src/globals/operations/local/findOne.ts#L103-L139","documentation":"Thrown by findGlobalLocal (the Local API findGlobal) when the supplied globalSlug is not present in payload.globals.config. Guards the operation before delegating to findOneOperation. Surfaced as APIError.","triggerScenarios":"Calling payload.findGlobal({ slug: 'mistyped' }) with a slug that does not match any registered global.","commonSituations":"Slug typo; renamed global; calling before init; dynamic slug resolved from user input without validation.","solutions":["Validate the slug against payload.globals.config before calling.","Drive callers from a typed GlobalSlug constant rather than a free string.","After renaming a global, update all callers and keep an alias if backward compat is required.","Confirm the global is declared in payload.config.globals."],"exampleFix":"// before\nconst doc = await payload.findGlobal({ slug: 'stte' })\n\n// after\nconst KNOWN_GLOBALS = payload.globals.config.map(g => g.slug)\nif (!KNOWN_GLOBALS.includes(slug)) {\n  return null\n}\nconst doc = await payload.findGlobal({ slug })","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  return await payload.findGlobal({ slug })\n} catch (err) {\n  if (err instanceof APIError && /can't be found/.test(err.message)) return null\n  throw err\n}","preventionTips":["Keep global slugs in a shared typed constant file.","Validate dynamic slugs from user input before calling the Local API."],"tags":["globals","local-api","config","validation"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}