{"record":{"id":"9d831d9d65c0cfca","repo":"cube-js/cube","slug":"no-directory-found","errorCode":null,"errorMessage":"No directory found","messagePattern":"No directory found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-templates/src/PackageFetcher.ts","lineNumber":76,"sourceCode":"  }\n\n  public async downloadPackages() {\n    await this.downloadRepo();\n\n    // Only ever a gzipped tar (GitHub's /archive/<ref>.tar.gz). `tar.x` refuses to\n    // write outside `cwd`: a leading `/` is stripped on extraction and entries containing `..` are\n    // dropped — but dropped with a warning rather than an error, so surface it.\n    await tar.x({\n      file: this.repoArchivePath,\n      cwd: this.tmpFolderPath,\n      preserveOwner: false,\n      onwarn: (code, message) => console.warn(`tar skipped an entry (${code}): ${message}`),\n    });\n\n    const dir = fs.readdirSync(this.tmpFolderPath).find((name) => !name.endsWith('tar.gz'));\n\n    if (!dir) {\n      throw new Error('No directory found');\n    }\n\n    fs.removeSync(path.resolve(this.tmpFolderPath, dir, 'yarn.lock'));\n    await executeCommand('npm', ['install'], { cwd: path.resolve(this.tmpFolderPath, dir) });\n\n    return {\n      packagesPath: path.join(this.tmpFolderPath, dir, 'packages'),\n    };\n  }\n\n  public cleanup() {\n    fs.removeSync(this.tmpFolderPath);\n  }\n}\n","sourceCodeStart":58,"sourceCodeEnd":91,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-templates/src/PackageFetcher.ts#L58-L91","documentation":"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.","triggerScenarios":"Thrown at packages/cubejs-templates/src/PackageFetcher.ts:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the repo/ref used for the archive URL exists and points at a valid template repository.","Check for tar warnings (logged as 'tar skipped an entry') that may indicate the archive contents were dropped or malformed.","Retry the fetch — a failed/partial download can produce an empty temp directory."],"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"}