{"record":{"id":"53c54daed277f50e","repo":"marmelab/react-admin","slug":"unknown-resource-resourcename-make-sure-it-has","errorCode":null,"errorMessage":"Unknown resource ${resourceName}. Make sure it has been declared on your server side schema. Known resources are ${knownResources.join(', ')}","messagePattern":"Unknown resource (.+?)\\. Make sure it has been declared on your server side schema\\. Known resources are (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-data-graphql-simple/src/buildQuery.ts","lineNumber":23,"sourceCode":"\nexport const buildQueryFactory =\n    (\n        buildVariablesImpl = buildVariables,\n        buildGqlQueryImpl = buildGqlQuery,\n        getResponseParserImpl = getResponseParser\n    ) =>\n    (introspectionResults: IntrospectionResult): BuildQuery => {\n        const knownResources = introspectionResults.resources.map(\n            r => r.type.name\n        );\n\n        const buildQuery: BuildQuery = (raFetchType, resourceName, params) => {\n            const resource = introspectionResults.resources.find(\n                r => r.type.name === resourceName\n            );\n\n            if (!resource) {\n                throw new Error(\n                    `Unknown resource ${resourceName}. Make sure it has been declared on your server side schema. Known resources are ${knownResources.join(\n                        ', '\n                    )}`\n                );\n            }\n\n            const queryType = resource[raFetchType];\n\n            if (!queryType) {\n                throw new Error(\n                    `No query or mutation matching fetch type ${raFetchType} could be found for resource ${resource.type.name}`\n                );\n            }\n\n            const variables = buildVariablesImpl(introspectionResults)(\n                resource,\n                raFetchType,\n                params,","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-data-graphql-simple/src/buildQuery.ts#L5-L41","documentation":"buildQuery looks up the requested resource in the introspected GraphQL schema results. If no introspected type matches resourceName, the data provider cannot build any query and throws, listing the resources it does know.","triggerScenarios":"Calling the data provider with a <Resource name=\"...\"> or getList/getOne/etc. whose name does not match any type in introspectionResults.resources — e.g. fetching 'posts' when the GraphQL type is 'Post', or a resource absent from the queried schema.","commonSituations":"Case mismatch between Resource name and GraphQL type; resource added on the frontend before the backend schema exposes it; restrictive introspection query filtering out types; typo in resource name.","solutions":["Match the resource name to the GraphQL type name exactly (check the known resources list in the error).","Re-run/extend the introspection so the type is included (check the INTROSPECTION_QUERY / include/exclude options).","Remove or rename the frontend <Resource> that has no server-side counterpart.","Ensure the backend schema was deployed and exposes the type."],"exampleFix":"// before\n<Resource name=\"posts\" ... /> // GraphQL type is 'Post'\n// after\n<Resource name=\"Post\" ... />","handlingStrategy":"validation","validationCode":"const known = introspectionResults.resources.map(r => r.type.name);\nif (!known.includes(resourceName)) {\n  console.warn(`Resource ${resourceName} missing from GraphQL schema; known: ${known.join(', ')}`);\n}","typeGuard":"const isKnownResource = (\n  name: string,\n  resources: { type: { name: string } }[]\n): resources is { type: { name: string } }[] & { type: { name: string } }[] =>\n  resources.some(r => r.type.name === name);","tryCatchPattern":"try {\n  return await dataProvider.getList(resourceName, params);\n} catch (e) {\n  if (e.message.startsWith('Unknown resource')) {\n    console.error('Resource not in schema:', resourceName, e);\n  }\n  throw e;\n}","preventionTips":["Name <Resource> entries exactly after GraphQL type names.","Log the known-resources list at app bootstrap during development.","Diff the introspected schema in CI to catch removed/renamed types."],"tags":["graphql","schema","introspection","ra-data-graphql-simple"],"backgroundTag":"unknown-resource","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}