cube-js/cube · error

root package not found

Error message

root package not found

What it means

Thrown in DependencyTree.getRootNode when no package in the manifest qualifies as the root: a root must have installsTo == null and be one of the requested templatePackages. If the manifest is missing such a package, the dependency tree cannot be traversed from a top-level entry point.

Source

Thrown at packages/cubejs-templates/src/DependencyTree.ts:39

    if (diff.length) {
      throw new Error(`The following packages could not be resolved: ${diff.join(', ')}`);
    }
  }

  protected packages() {
    return <Package[]> this.manifest.packages;
  }

  public getRootNode() {
    if (this.rootNode) {
      return this.rootNode;
    }

    const rootPackages = this.packages().filter((pkg) => pkg.installsTo == null);
    const root = rootPackages.find((pkg) => this.templatePackages.includes(pkg.name));

    if (!root) {
      throw new Error('root package not found');
    }

    this.resolved.push(root.name);

    this.rootNode = {
      package: root,
      children: [],
    };

    return this.rootNode;
  }

  protected packagesInstalledTo(name): Record<string, unknown> {
    return indexByName(this.packages().filter((pkg) => (pkg.installsTo || {})[name]));
  }

  protected getChildren(pkg): any[] {
    const children: any[] = [];

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Ensure the template manifest contains a package whose installsTo is null and whose name appears in templatePackages.
  2. Check that at least one of the requested packages is an entry-point (base) package of the template.
  3. Regenerate or repair the template manifest if packages data is corrupted or empty.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-templates/src/DependencyTree.ts:39 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/47647986980c2748. Report an issue: GitHub.