cube-js/cube · error

No directory found

Error message

No directory found

What it means

Thrown in PackageFetcher.downloadPackages after downloading and extracting the template repo archive: the expected single top-level directory was not found in the temp folder. This indicates the GitHub archive extracted into an unexpected layout (empty archive or multiple/zero top-level dirs), so the template files cannot be located.

Source

Thrown at packages/cubejs-templates/src/PackageFetcher.ts:76

  }

  public async downloadPackages() {
    await this.downloadRepo();

    // Only ever a gzipped tar (GitHub's /archive/<ref>.tar.gz). `tar.x` refuses to
    // write outside `cwd`: a leading `/` is stripped on extraction and entries containing `..` are
    // dropped — but dropped with a warning rather than an error, so surface it.
    await tar.x({
      file: this.repoArchivePath,
      cwd: this.tmpFolderPath,
      preserveOwner: false,
      onwarn: (code, message) => console.warn(`tar skipped an entry (${code}): ${message}`),
    });

    const dir = fs.readdirSync(this.tmpFolderPath).find((name) => !name.endsWith('tar.gz'));

    if (!dir) {
      throw new Error('No directory found');
    }

    fs.removeSync(path.resolve(this.tmpFolderPath, dir, 'yarn.lock'));
    await executeCommand('npm', ['install'], { cwd: path.resolve(this.tmpFolderPath, dir) });

    return {
      packagesPath: path.join(this.tmpFolderPath, dir, 'packages'),
    };
  }

  public cleanup() {
    fs.removeSync(this.tmpFolderPath);
  }
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Verify the repo/ref used for the archive URL exists and points at a valid template repository.
  2. Check for tar warnings (logged as 'tar skipped an entry') that may indicate the archive contents were dropped or malformed.
  3. Retry the fetch — a failed/partial download can produce an empty temp directory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-templates/src/PackageFetcher.ts:76 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/9d831d9d65c0cfca. Report an issue: GitHub.