cube-js/cube · error
Method is not supported for a '${this.queryType}' query type
Error message
Method is not supported for a '${this.queryType}' query type. Please use decompose What it means
ResultSet.query() returns the original query of a regular (single) query result. When the result is a comparative/blended query (e.g. created via compareDateRange or decomposed results), the single query accessor is meaningless, so the library throws and directs you to decompose(), which yields one ResultSet per sub-query.
Source
Thrown at packages/cubejs-client-core/src/ResultSet.ts:1107
),
shortTitle: this.axisValuesString(
normalizedPivotConfig.y.find(d => d === 'measures') ?
dropLast(1, aliasedAxis).concat(
measures[
ResultSet.measureFromAxis(axisValues)
].shortTitle
) :
aliasedAxis, ', '
),
key: this.axisValuesString(aliasedAxis, ','),
yValues: axisValues
};
});
}
public query(): Query {
if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) {
throw new Error(`Method is not supported for a '${this.queryType}' query type. Please use decompose`);
}
return this.loadResponses[0].query;
}
public pivotQuery(): PivotQuery {
return this.loadResponse.pivotQuery || null;
}
/**
* @return the total number of rows if the `total` option was set, when sending the query
*/
public totalRows(): number | null | undefined {
return this.loadResponses[0].total;
}
public rawData(): T[] {
if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) {View on GitHub (pinned to 7d981676b3)
Solutions
- Call decompose() and use decompose()[0].query to access the first sub-query's query
- Branch on the queryType (or resultSet.queryType === 'regular') before accessing query()
- Re-run the query without compareDateRange/blending if a single ResultSet API surface is needed
Example fix
// before const q = resultSet.query(); // after const q = resultSet.queryType === 'regular' ? resultSet.query() : resultSet.decompose()[0].query();
Defensive patterns
Strategy: type-guard
Validate before calling
const q = rs.queryType === 'regular' ? rs.query() : rs.decompose()[0].query();
Type guard
function isRegular(rs: ResultSet): rs is ResultSet {
return (rs as any).queryType === 'regular';
} Try / catch
let query;
try { query = rs.query(); } catch (e) {
if (String(e?.message).includes('use decompose')) query = rs.decompose()[0].query();
else throw e;
} Prevention
- Check queryType whenever results can come from compareDateRange or blendingQueries
- Use decompose() uniformly — it works for regular queries too (returns [this]-equivalent single result)
- Type helper functions to accept the query type they actually support
- Add unit tests covering both single and comparison result paths
When it happens
Trigger: Calling resultSet.query() on a ResultSet whose queryType is not REGULAR_QUERY — typically a result produced by compareDateRange() (QUERY_TYPE.COMPARE_DATE_RANGE_QUERY) or blendingQueries (QUERY_TYPE.BLENDING_QUERY).
Common situations: Rendering code shared between single and comparison charts that always calls query(); refactors where compareDateRange results are fed to components written for plain queries; TypeScript not catching it because queryType is runtime state.
Related errors
- Unsupported method: ${message.method}
- Query must be defined in options
- Unknown query type
- compareDateRange drillDown query is not currently supported
- resultIndex is required
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/a33b3c6924d41989.
Report an issue: GitHub.