cube-js/cube · error · CompileError
CompileError with joined messageParts and plainMessageParts
Error message
CompileError with joined messageParts and plainMessageParts (data model compilation errors report)
What it means
ErrorReporter.throwIfAny aggregates all errors collected during data model compilation, groups them per file, and throws a single CompileError whose message joins all formatted messageParts (with a plain-text variant from plainMessageParts). This is the standard 'your data models failed to compile' report rather than an individual failure.
Source
Thrown at packages/cubejs-schema-compiler/src/compiler/ErrorReporter.ts:214
const plainMessagesForFile: string[] = [];
for (const error of fileErrors) {
messageParts.push(error.message);
if (error.plainMessage) {
plainMessagesForFile.push(error.plainMessage);
}
}
if (plainMessagesForFile.length > 0) {
plainMessageParts.push(`${reportFileName}Errors:`);
plainMessageParts.push(...plainMessagesForFile);
plainMessageParts.push('');
}
// Add blank line between file groups
messageParts.push('');
}
throw new CompileError(
messageParts.join('\n'),
plainMessageParts.join('\n')
);
}
public getErrors() {
return this.rootReporter().errors;
}
public addErrors(errors: PossibleError[], fileName?: string) {
errors.forEach((e: any) => { this.error(e, fileName); });
}
public getWarnings() {
return this.rootReporter().warnings;
}
public addWarnings(warnings: SyntaxErrorInterface[]) {View on GitHub (pinned to 7d981676b3)
Solutions
- Read each grouped section of the CompileError message — it lists file and error line by line
- Fix the underlying schema errors listed; this exception is only the aggregate report
- Run compilation locally on single files to isolate individual failures
- Inspect the plain message part (second CompileError argument) for clean text in logs
Defensive patterns
Strategy: try-catch
Try / catch
try {
await compiler.compile();
} catch (e) {
if (e instanceof CompileError) {
e.message.split('\n').forEach(line => console.error(line)); // per-file grouped errors
}
} Prevention
- Compile data models in CI on every change
- Fix all listed errors in one pass — the report aggregates every file
- Use the plain-message variant for machine-readable logs
When it happens
Trigger: Any call to throwIfAny after compilation steps recorded errors via the ErrorReporter — syntax errors, validation errors, or multiple schema files failing at once during compileDataSchema / transpile flows.
Common situations: Migrating many data model files at once, a typo in a cube definition, or CI validating schemas where several files carry errors; developers often see multiple errors bundled into one exception.
Related errors
- Expected one parameter but nothing found
- Expected only 2 parameters for timestamp filter but got: ${t
- Unsupported timestamp precision: ${this.query.timestampPreci
- Unsupported measure type replacement for ${sourceMeasure}: $
- Unsupported additional filters for measure ${sourceMeasure}
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/e40c9c4479c6f570.
Report an issue: GitHub.