{"record":{"id":"454db703fa036e6b","repo":"cube-js/cube","slug":"the-following-packages-could-not-be-resolved-di","errorCode":null,"errorMessage":"The following packages could not be resolved: ${diff.join(', ')}","messagePattern":"The following packages could not be resolved: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-templates/src/DependencyTree.ts","lineNumber":22,"sourceCode":"  name: string;\n  version: string;\n  installsTo: string[] | null;\n  receives: Record<string, string>;\n};\n\nconst indexByName = (packages: Package[]) => R.indexBy(R.prop('name'), packages);\n\nexport class DependencyTree {\n  protected rootNode: any = null;\n\n  protected resolved: any[] = [];\n\n  public constructor(private manifest: Record<string, unknown>, private templatePackages: string[]) {\n    this.build(this.getRootNode());\n\n    const diff = R.difference(templatePackages, this.resolved);\n    if (diff.length) {\n      throw new Error(`The following packages could not be resolved: ${diff.join(', ')}`);\n    }\n  }\n\n  protected packages() {\n    return <Package[]> this.manifest.packages;\n  }\n\n  public getRootNode() {\n    if (this.rootNode) {\n      return this.rootNode;\n    }\n\n    const rootPackages = this.packages().filter((pkg) => pkg.installsTo == null);\n    const root = rootPackages.find((pkg) => this.templatePackages.includes(pkg.name));\n\n    if (!root) {\n      throw new Error('root package not found');\n    }","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-templates/src/DependencyTree.ts#L4-L40","documentation":"Validation error in the DependencyTree constructor: after walking the dependency graph from the root, some of the requested templatePackages were never reached — they are absent from the template's package manifest or not connected to the resolved root, so the tree cannot be built for them.","triggerScenarios":"Thrown at packages/cubejs-templates/src/DependencyTree.ts:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that every package listed in templatePackages exists in the template manifest's packages array.","Verify each listed package is reachable from the root package (packages with installsTo == null) via installsTo links.","Remove or correct misspelled package names in the template configuration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}