{"record":{"id":"de55663b713367f7","repo":"payloadcms/payload","slug":"the-collection-with-slug-string-collectionslug-de5566","errorCode":null,"errorMessage":"The collection with slug ${String(collectionSlug)} can't be found. Find Versions Operation.","messagePattern":"The collection with slug (.+?) can't be found\\. Find Versions Operation\\.","errorType":"http","errorClass":"APIError","httpStatus":500,"severity":"error","filePath":"packages/payload/src/collections/operations/local/findVersions.ts","lineNumber":129,"sourceCode":"  const {\n    collection: collectionSlug,\n    depth,\n    limit,\n    overrideAccess = true,\n    page,\n    pagination = true,\n    populate,\n    select,\n    showHiddenFields,\n    sort,\n    trash = false,\n    where,\n  } = options\n\n  const collection = payload.collections[collectionSlug]\n\n  if (!collection) {\n    throw new APIError(\n      `The collection with slug ${String(collectionSlug)} can't be found. Find Versions Operation.`,\n    )\n  }\n\n  return findVersionsOperation({\n    collection,\n    depth,\n    limit,\n    overrideAccess,\n    page,\n    pagination,\n    populate,\n    req: await createLocalReq(options as CreateLocalReqOptions, payload),\n    select,\n    showHiddenFields,\n    sort,\n    trash,\n    where,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/payload/src/collections/operations/local/findVersions.ts#L111-L147","documentation":"Thrown by the Local API `findVersions` wrapper in packages/payload/src/collections/operations/local/findVersions.ts:129 when `payload.findVersions({ collection })` references a slug absent from `payload.collections`. Defaults to HTTP 500. Applies only to versioned collections.","triggerScenarios":"Calling `payload.findVersions({ collection: 'page' })` with a misspelled slug; listing versions for a collection that no longer has versions enabled; calling before collections are registered.","commonSituations":"Slug typo or stale constant; collection renamed/removed; versions config removed; `as CollectionSlug` cast on dynamic input.","solutions":["Match the slug to the collection config's `slug` value.","Confirm versions are still enabled on the collection.","Log `Object.keys(payload.collections)` to verify registration.","Avoid `as CollectionSlug` casts on runtime strings."],"exampleFix":"// before\nawait payload.findVersions({ collection: 'page' }) // slug is 'pages'\n\n// after\nawait payload.findVersions({ collection: 'pages' })","handlingStrategy":"validation","validationCode":"function assertCollectionSlug(payload: Payload, slug: string): void {\n  if (!(slug in payload.collections)) {\n    throw new Error(`Unknown collection slug '${slug}'`)\n  }\n}\nassertCollectionSlug(payload, 'pages')\nawait payload.findVersions({ collection: 'pages' })","typeGuard":"const slugIsRegistered = (payload: Payload, slug: string): slug is CollectionSlug =>\n  slug in (payload.collections as Record<string, unknown>)\n\nif (slugIsRegistered(payload, slug)) {\n  await payload.findVersions({ collection: slug })\n}","tryCatchPattern":"try {\n  await payload.findVersions({ collection: slug })\n} catch (err) {\n  if (err instanceof APIError && /Find Versions Operation/.test(err.message)) {\n    // unknown slug — correct it\n  } else throw err\n}","preventionTips":["Confirm versions are still enabled on the collection.","Keep slug constants in sync with config.","Avoid `as CollectionSlug` casts on dynamic input."],"tags":["local-api","collection","slug","versions","configuration"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}