{"record":{"id":"e40c9c4479c6f570","repo":"cube-js/cube","slug":"compileerror-with-joined-messageparts-and-plainmes","errorCode":null,"errorMessage":"CompileError with joined messageParts and plainMessageParts (data model compilation errors report)","messagePattern":"CompileError with joined messageParts and plainMessageParts \\(data model compilation errors report\\)","errorType":"exception","errorClass":"CompileError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/compiler/ErrorReporter.ts","lineNumber":214,"sourceCode":"      const plainMessagesForFile: string[] = [];\n      for (const error of fileErrors) {\n        messageParts.push(error.message);\n        if (error.plainMessage) {\n          plainMessagesForFile.push(error.plainMessage);\n        }\n      }\n\n      if (plainMessagesForFile.length > 0) {\n        plainMessageParts.push(`${reportFileName}Errors:`);\n        plainMessageParts.push(...plainMessagesForFile);\n        plainMessageParts.push('');\n      }\n\n      // Add blank line between file groups\n      messageParts.push('');\n    }\n\n    throw new CompileError(\n      messageParts.join('\\n'),\n      plainMessageParts.join('\\n')\n    );\n  }\n\n  public getErrors() {\n    return this.rootReporter().errors;\n  }\n\n  public addErrors(errors: PossibleError[], fileName?: string) {\n    errors.forEach((e: any) => { this.error(e, fileName); });\n  }\n\n  public getWarnings() {\n    return this.rootReporter().warnings;\n  }\n\n  public addWarnings(warnings: SyntaxErrorInterface[]) {","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/compiler/ErrorReporter.ts#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await compiler.compile();\n} catch (e) {\n  if (e instanceof CompileError) {\n    e.message.split('\\n').forEach(line => console.error(line)); // per-file grouped errors\n  }\n}","preventionTips":["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"],"tags":["compilation","error-reporting","schema-compiler"],"backgroundTag":"schema-compilation-failed","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}