{"record":{"id":"cffa2351d3167eeb","repo":"payloadcms/payload","slug":"missing-id-of-version","errorCode":null,"errorMessage":"Missing ID of version.","messagePattern":"Missing ID of version\\.","errorType":"http","errorClass":"APIError","httpStatus":400,"severity":"warning","filePath":"packages/payload/src/collections/operations/findVersionByID.ts","lineNumber":52,"sourceCode":"  args: Arguments,\n): Promise<TypeWithVersion<TData>> => {\n  const {\n    id,\n    collection: { config: collectionConfig },\n    currentDepth,\n    depth,\n    disableErrors,\n    overrideAccess,\n    populate,\n    req: { fallbackLocale, locale, payload },\n    req,\n    select: incomingSelect,\n    showHiddenFields,\n    trash = false,\n  } = args\n\n  if (!id) {\n    throw new APIError('Missing ID of version.', httpStatus.BAD_REQUEST)\n  }\n\n  try {\n    // /////////////////////////////////////\n    // beforeOperation - Collection\n    // /////////////////////////////////////\n\n    args = await buildBeforeOperation({\n      args,\n      collection: collectionConfig,\n      operation: 'findVersionByID',\n      overrideAccess,\n    })\n\n    // /////////////////////////////////////\n    // Access\n    // /////////////////////////////////////\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/payload/src/collections/operations/findVersionByID.ts#L34-L70","documentation":"In `findVersionByIDOperation`, if `id` is falsy it throws `APIError` (400). A version ID is required to look up a specific version.","triggerScenarios":"`findVersionByID({ collection, id })` (or `GET /api/{collection}/versions/{id}`) with no id, or `id: undefined`.","commonSituations":"Route param missing; id variable undefined; a refactor dropped the id argument.","solutions":["Pass a non-empty version `id`.","Validate the param before the call."],"exampleFix":"// before\nawait payload.findVersionByID({ collection: 'posts', id: maybeId })\n// after\nif (!id) throw new Error('version id required')\nawait payload.findVersionByID({ collection: 'posts', id })","handlingStrategy":"validation","validationCode":"function requireVersionId(id) {\n  if (!id) throw new Error('version id required')\n}","typeGuard":"function hasVersionId(id): id is string | number {\n  return id !== undefined && id !== null && id !== ''\n}","tryCatchPattern":null,"preventionTips":["Validate version id presence before the call.","Type the id as required in route handlers."],"tags":["versions","validation","id"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}