marmelab/react-admin · error · Error

No query or mutation matching fetch type ${raFetchType} coul

Error message

No query or mutation matching fetch type ${raFetchType} could be found for resource ${resource.type.name}

What it means

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.

Source

Thrown at packages/ra-data-graphql-simple/src/buildQuery.ts:33

        );

        const buildQuery: BuildQuery = (raFetchType, resourceName, params) => {
            const resource = introspectionResults.resources.find(
                r => r.type.name === resourceName
            );

            if (!resource) {
                throw new Error(
                    `Unknown resource ${resourceName}. Make sure it has been declared on your server side schema. Known resources are ${knownResources.join(
                        ', '
                    )}`
                );
            }

            const queryType = resource[raFetchType];

            if (!queryType) {
                throw new Error(
                    `No query or mutation matching fetch type ${raFetchType} could be found for resource ${resource.type.name}`
                );
            }

            const variables = buildVariablesImpl(introspectionResults)(
                resource,
                raFetchType,
                params,
                queryType
            );
            const query = buildGqlQueryImpl(introspectionResults)(
                resource,
                raFetchType,
                queryType,
                variables
            );
            const parseResponse = getResponseParserImpl(introspectionResults)(
                raFetchType,

View on GitHub (pinned to 051f511bb0)

Solutions

  1. Check the GraphQL schema for the needed query/mutation and add it server-side if missing.
  2. Remove frontend resources/actions (e.g. Create) for read-only types.
  3. Verify the fetch-type-to-operation mapping in the buildQuery factory options.
  4. Confirm the introspection result includes both queries and mutations for the type.

Example fix

// before
dataProvider.create('Comment', { data }) // Comment type has no createComment mutation
// after: add createComment to the schema, or remove the Create resource for Comment
Defensive patterns

Strategy: validation

Validate before calling

// Only expose actions the schema supports:
const supportsMutation = introspectionResults.resources
  .find(r => r.type.name === resourceType)?.create != null;
{supportsMutation && <Create ... />}

Type guard

const supportsFetchType = (
  resource: Record<string, unknown> | undefined,
  raFetchType: string
): boolean => Boolean(resource && Array.isArray(resource[raFetchType]) && (resource[raFetchType] as unknown[]).length > 0);

Try / catch

try {
  return await dataProvider.create(resource, { data });
} catch (e) {
  if (e.message.includes('No query or mutation matching fetch type')) {
    notify('This operation is not supported for this resource');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Backend schema lacking mutations (read-only APIs) while the frontend includes Create/Edit resources; custom raFetchType mapping mistakes; introspection not picking up mutations.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30). Data as JSON: /api/errors/20c5d6d177ee3c32. Report an issue: GitHub.