{"record":{"id":"a33b3c6924d41989","repo":"cube-js/cube","slug":"method-is-not-supported-for-a-this-querytype","errorCode":null,"errorMessage":"Method is not supported for a '${this.queryType}' query type. Please use decompose","messagePattern":"Method is not supported for a '(.+?)' query type\\. Please use decompose","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-client-core/src/ResultSet.ts","lineNumber":1107,"sourceCode":"        ),\n        shortTitle: this.axisValuesString(\n          normalizedPivotConfig.y.find(d => d === 'measures') ?\n            dropLast(1, aliasedAxis).concat(\n              measures[\n                ResultSet.measureFromAxis(axisValues)\n              ].shortTitle\n            ) :\n            aliasedAxis, ', '\n        ),\n        key: this.axisValuesString(aliasedAxis, ','),\n        yValues: axisValues\n      };\n    });\n  }\n\n  public query(): Query {\n    if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) {\n      throw new Error(`Method is not supported for a '${this.queryType}' query type. Please use decompose`);\n    }\n\n    return this.loadResponses[0].query;\n  }\n\n  public pivotQuery(): PivotQuery {\n    return this.loadResponse.pivotQuery || null;\n  }\n\n  /**\n   * @return the total number of rows if the `total` option was set, when sending the query\n   */\n  public totalRows(): number | null | undefined {\n    return this.loadResponses[0].total;\n  }\n\n  public rawData(): T[] {\n    if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) {","sourceCodeStart":1089,"sourceCodeEnd":1125,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-client-core/src/ResultSet.ts#L1089-L1125","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nconst q = resultSet.query();\n// after\nconst q = resultSet.queryType === 'regular'\n  ? resultSet.query()\n  : resultSet.decompose()[0].query();","handlingStrategy":"type-guard","validationCode":"const q = rs.queryType === 'regular' ? rs.query() : rs.decompose()[0].query();","typeGuard":"function isRegular(rs: ResultSet): rs is ResultSet {\n  return (rs as any).queryType === 'regular';\n}","tryCatchPattern":"let query;\ntry { query = rs.query(); } catch (e) {\n  if (String(e?.message).includes('use decompose')) query = rs.decompose()[0].query();\n  else throw e;\n}","preventionTips":["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"],"tags":["compare-date-range","blended-query","resultset","api-misuse"],"backgroundTag":"method-unsupported-for-query-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}