{"record":{"id":"411226395d12a05f","repo":"cube-js/cube","slug":"model-files-not-found-please-make-sure-the-thi","errorCode":null,"errorMessage":"Model files not found. Please make sure the \"${this.repositoryPath}\" directory exists and contains model files.","messagePattern":"Model files not found\\. Please make sure the \"(.+?)\" directory exists and contains model files\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-shared/src/FileRepository.ts","lineNumber":34,"sourceCode":"export class FileRepository implements SchemaFileRepository {\n  public constructor(\n    protected readonly repositoryPath: string\n  ) {\n  }\n\n  public localPath(): string {\n    return path.join(process.cwd(), this.repositoryPath);\n  }\n\n  protected async getFiles(dir: string, fileList: string[] = []): Promise<string[]> {\n    let files: string[] = [];\n\n    try {\n      const fullPath = path.join(this.localPath(), dir);\n      await fs.ensureDir(fullPath);\n      files = await fs.readdir(fullPath);\n    } catch (e) {\n      throw new Error(`Model files not found. Please make sure the \"${this.repositoryPath}\" directory exists and contains model files.`);\n    }\n\n    // eslint-disable-next-line no-restricted-syntax\n    for (const file of files) {\n      const stat = await fs.stat(path.join(this.localPath(), dir, file));\n      if (stat.isDirectory()) {\n        fileList = await this.getFiles(path.join(dir, file), fileList);\n      } else fileList.push(path.join(dir, file));\n    }\n\n    return fileList;\n  }\n\n  public async dataSchemaFiles(includeDependencies: boolean = false): Promise<FileContent[]> {\n    const files = await this.getFiles('');\n\n    let result = await Promise.all(\n      files","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/FileRepository.ts#L16-L52","documentation":"Startup guard in FileRepository.getFiles: the configured schema directory (repositoryPath, e.g. the /model folder relative to cwd) could not be read by fs.readdir. It fires when the schema directory does not exist or is unreadable, meaning no data models can be compiled — a fatal configuration/environment problem at repository access time.","triggerScenarios":"Thrown at packages/cubejs-backend-shared/src/FileRepository.ts:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the schema directory (by default ./model relative to the project working directory) and add at least one model file.","Verify the CUBEJS_SCHEMA_PATH / repositoryPath configuration points to the right location.","Check that the process working directory and file permissions allow reading the 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"}