{"record":{"id":"20c5d6d177ee3c32","repo":"marmelab/react-admin","slug":"no-query-or-mutation-matching-fetch-type-rafetch","errorCode":null,"errorMessage":"No query or mutation matching fetch type ${raFetchType} could be found for resource ${resource.type.name}","messagePattern":"No query or mutation matching fetch type (.+?) could be found for resource (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ra-data-graphql-simple/src/buildQuery.ts","lineNumber":33,"sourceCode":"        );\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,\n                queryType\n            );\n            const query = buildGqlQueryImpl(introspectionResults)(\n                resource,\n                raFetchType,\n                queryType,\n                variables\n            );\n            const parseResponse = getResponseParserImpl(introspectionResults)(\n                raFetchType,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-data-graphql-simple/src/buildQuery.ts#L15-L51","documentation":"After finding the resource, buildQuery reads resource[raFetchType] — the query or mutation collection for that fetch type (getList -> query, create/update/delete -> mutation). If the introspected type exposes no operation for that fetch type, the provider throws.","triggerScenarios":"Calling a fetch type that has no matching GraphQL operation for the resource, e.g. calling 'create' on a type that only defines a query, or a raFetchType key (GET_LIST, CREATE, etc.) that does not map to anything in the introspected resource.","commonSituations":"Backend schema lacking mutations (read-only APIs) while the frontend includes Create/Edit resources; custom raFetchType mapping mistakes; introspection not picking up mutations.","solutions":["Check the GraphQL schema for the needed query/mutation and add it server-side if missing.","Remove frontend resources/actions (e.g. Create) for read-only types.","Verify the fetch-type-to-operation mapping in the buildQuery factory options.","Confirm the introspection result includes both queries and mutations for the type."],"exampleFix":"// before\ndataProvider.create('Comment', { data }) // Comment type has no createComment mutation\n// after: add createComment to the schema, or remove the Create resource for Comment","handlingStrategy":"validation","validationCode":"// Only expose actions the schema supports:\nconst supportsMutation = introspectionResults.resources\n  .find(r => r.type.name === resourceType)?.create != null;\n{supportsMutation && <Create ... />}","typeGuard":"const supportsFetchType = (\n  resource: Record<string, unknown> | undefined,\n  raFetchType: string\n): boolean => Boolean(resource && Array.isArray(resource[raFetchType]) && (resource[raFetchType] as unknown[]).length > 0);","tryCatchPattern":"try {\n  return await dataProvider.create(resource, { data });\n} catch (e) {\n  if (e.message.includes('No query or mutation matching fetch type')) {\n    notify('This operation is not supported for this resource');\n  }\n  throw e;\n}","preventionTips":["Remove Create/Edit/Delete resources for read-only GraphQL types.","Audit the schema for missing queries/mutations per type during setup.","Gate UI actions on introspection capabilities."],"tags":["graphql","schema","ra-data-graphql-simple"],"backgroundTag":"unsupported-operation","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}