refinedev/refine · error · Error
GraphQL needs operation, fields and variables values in meta
Error message
GraphQL needs operation, fields and variables values in meta object.
What it means
The nestjs-query data provider's custom() method requires a meta object with operation, fields, and variables. This error is thrown when meta is missing entirely or one of its required members is absent, so the provider cannot build a valid GraphQL request.
Source
Thrown at packages/nestjs-query/src/dataProvider/index.ts:493
variables: meta.variables,
});
query = gqlMutation.query;
variables = gqlMutation.variables;
}
const response = await _client.request<BaseRecord>({
document: query,
variables,
});
return {
data: response[meta.operation],
};
}
throw Error("GraphQL operation name required.");
}
throw Error(
"GraphQL needs operation, fields and variables values in meta object.",
);
},
};
};
export default dataProvider;
View on GitHub (pinned to 779d52a20e)
Solutions
- Pass the full meta object { operation, fields, variables }, using empty arrays/objects where unused
- Check the nestjs-query provider docs for the exact custom() contract
- Use a direct GraphQL client if you need arbitrary requests
Example fix
// before
await dataProvider.custom({ url: "/things", method: "get" });
// after
await dataProvider.custom({ url: "", method: "get", meta: { operation: "things", fields: ["id", "name"], variables: {} } }); Defensive patterns
Strategy: validation
Validate before calling
const metaOk = !!meta && "operation" in meta && "fields" in meta && "variables" in meta;
Type guard
const isCustomMeta = (m: unknown): m is { operation: string; fields: any[]; variables: Record<string, unknown> } =>
typeof m === "object" && m !== null && "operation" in m && "fields" in m && "variables" in m; Try / catch
try { await dataProvider.custom({ url, method, meta }); } catch (e) { if (String(e).includes("meta object")) { /* build complete meta */ } else throw e; } Prevention
- Never call nestjs-query custom() without a fully populated meta
- Type custom() params at the call site
When it happens
Trigger: Calling custom({ url, method }) without a meta object, or with a meta missing fields/variables.
Common situations: Using the REST-style custom() signature; upgrading refine where the meta contract is enforced; copying example code from REST provider docs.
Related errors
- GraphQL need to operation, fields and variables values in me
- GraphQL operation name required.
- GraphQL operation name required.
- GraphQL does not support ${method} method.
- Invalid action type
AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27).
Data as JSON: /api/errors/294c790050fafb04.
Report an issue: GitHub.