cube-js/cube · error
(error as Error).message || error
Error message
(error as Error).message || error
What it means
Not a thrown error: in DevServer's pre-aggregation code conversion endpoint, CubeSchemaConverter.generate() failures (schema parse/compile errors in the submitted pre-aggregation code) are caught and returned as HTTP 400 with the error message instead of crashing the dev server.
Source
Thrown at packages/cubejs-server-core/src/core/DevServer.ts:636
/**
* Important note:
* JS code for pre-agg includes the content of the pre-aggregation object
* without name, which is passed as preAggregationName.
* While yaml code for pre-agg includes whole yaml object including name.
*/
const schemaConverter = new CubeSchemaConverter(this.cubejsServer.repository, [
new CubePreAggregationConverter({
cubeName,
preAggregationName,
code
})
]);
try {
await schemaConverter.generate(cubeName);
} catch (error) {
return res.status(400).json({ error: (error as Error).message || error });
}
const file = schemaConverter.getSourceFiles().find(
({ cubeName: currentCubeName }) => currentCubeName === cubeName
);
if (!file) {
return res.status(400).json({ error: `The schema file for "${cubeName}" cube was not found or could not be updated. Only JS and non-templated YAML files are supported.` });
}
this.cubejsServer.repository.writeDataSchemaFile(file.fileName, file.source);
return res.json('ok');
}));
}
protected getIdentifier(apiSecret: string): string {
return crypto.createHash('md5')
.update(apiSecret)View on GitHub (pinned to 7d981676b3)
Solutions
- Review the returned message — it describes the schema compilation problem in the converted pre-aggregation code.
- Check that the pre-aggregation definition (measures, dimensions, timeDimension, granularity) references existing cube members.
- Fix the pre-aggregation code in the data model and retry the conversion.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/cubejs-server-core/src/core/DevServer.ts:636 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/32921e1daf4a4dff.
Report an issue: GitHub.