{"record":{"id":"3af5d8e84a1ccfaa","repo":"payloadcms/payload","slug":"not-supported-3af5d8","errorCode":null,"errorMessage":"Not supported","messagePattern":"Not supported","errorType":"http","errorClass":"APIError","httpStatus":500,"severity":"error","filePath":"packages/payload/src/database/getLocalizedPaths.ts","lineNumber":182,"sourceCode":"              lastIncompletePath.path = pathSegments.join('.')\n              if (![matchedField.name, 'relationTo', 'value'].includes(pathSegments.at(-1)!)) {\n                lastIncompletePath.invalid = true\n              } else {\n                lastIncompletePath.complete = true\n              }\n            } else {\n              lastIncompletePath.complete = true\n              lastIncompletePath.path = currentPath!\n\n              const nestedPathToQuery = pathSegments\n                .slice(nextSegmentIsLocale ? i + 2 : i + 1)\n                .join('.')\n\n              if (nestedPathToQuery) {\n                let relatedCollection: SanitizedCollectionConfig\n                if (matchedField.type === 'join') {\n                  if (Array.isArray(matchedField.collection)) {\n                    throw new APIError('Not supported')\n                  }\n\n                  relatedCollection = payload.collections[matchedField.collection]!.config\n                } else {\n                  relatedCollection = payload.collections[matchedField.relationTo as string]!.config\n                }\n\n                const remainingPaths = getLocalizedPaths({\n                  collectionSlug: relatedCollection.slug,\n                  fields: relatedCollection.flattenedFields,\n                  globalSlug,\n                  incomingPath: nestedPathToQuery,\n                  locale,\n                  parentIsLocalized: false,\n                  payload,\n                })\n\n                paths = [...paths, ...remainingPaths]","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/payload/src/database/getLocalizedPaths.ts#L164-L200","documentation":"Thrown by `getLocalizedPaths` when a query drills into a nested path through a polymorphic join field — one whose `collection` is an array (it joins to multiple target collections). Payload only supports nested querying through single-collection relationships/joins; a multi-target join has no single schema to resolve nested fields against, so it is rejected with HTTP 500 'Not supported'.","triggerScenarios":"Querying `where[myJoinField.title][equals]=x` where `myJoinField` is a join field with `collection: ['posts', 'pages']` (polymorphic); using a deep `where` path on a join that targets more than one collection.","commonSituations":"A 'related items' join field configured across multiple collections; clients building dynamic filters that walk into joined relations; migrating from a single-collection join to multi-collection without updating queries.","solutions":["Restructure the join to target a single collection if you need nested filtering (`collection: 'posts'`).","Filter on the join field directly (e.g. `where[myJoinField.id]`) without descending into target-collection fields.","Run separate queries per target collection instead of one polymorphic nested query."],"exampleFix":"// before: polymorphic join, nested query fails\n{ name: 'related', type: 'join', collection: ['posts', 'pages'] }\n// query: where[related.title]=x  -> throws\n// after: single-collection join\n{ name: 'related', type: 'join', collection: 'posts' }\n// query: where[related.title]=x  -> ok","handlingStrategy":"validation","validationCode":"// Detect polymorphic joins and avoid nested where paths on them\nfor (const f of collectionConfig.fields) {\n  if (f.type === 'join' && Array.isArray(f.collection)) {\n    console.warn(`Join '${f.name}' is polymorphic; do not query nested paths through it.`)\n  }\n}","typeGuard":"function isPolymorphicJoin(f: any): boolean {\n  return f?.type === 'join' && Array.isArray(f?.collection)\n}","tryCatchPattern":"try {\n  await payload.find({ collection, where: { 'related.title': { equals: 'x' } } })\n} catch (err) {\n  if (err instanceof APIError && /Not supported/.test(err.message)) {\n    // switch to single-collection join or query targets separately\n  }\n  throw err\n}","preventionTips":["Use single-collection joins when you need nested filtering.","Filter only on the join field's own id/relationTo for polymorphic joins.","Document polymorphic-join limitations for API consumers."],"tags":["database","query","join","polymorphic","localization"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}