{"record":{"id":"df0b0b024cb7c878","repo":"cube-js/cube","slug":"manifestpath-was-not-found-please-run-dbt-c","errorCode":null,"errorMessage":"'${manifestPath}' was not found. Please run 'dbt compile' in '${projectPath}'","messagePattern":"'(.+?)' was not found\\. Please run 'dbt compile' in '(.+?)'","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-dbt-schema-extension/src/Dbt.ts","lineNumber":144,"sourceCode":"\nfunction mapMetricType(dbtMetricType: string): string {\n  if (!dbtToCubeMetricTypeMap[dbtMetricType]) {\n    throw new UserError(`Unsupported dbt metric type '${dbtMetricType}'`);\n  }\n\n  return dbtToCubeMetricTypeMap[dbtMetricType];\n}\n\nexport class Dbt extends AbstractExtension {\n  public async loadMetricCubesFromDbtProject(projectPath: string, options: DbtLoadOptions): Promise<{ [cubeName: string]: any }> {\n    const dbtProjectPath = path.join(projectPath, 'dbt_project.yml');\n    if (!(await fs.pathExists(dbtProjectPath))) {\n      throw new UserError(`'${dbtProjectPath}' was not found. Please make sure '${projectPath}' is a path to the dbt project`);\n    }\n    // TODO read target path from dbt_project.yml\n    const manifestPath = path.join(projectPath, 'target', 'manifest.json');\n    if (!(await fs.pathExists(manifestPath))) {\n      throw new UserError(`'${manifestPath}' was not found. Please run 'dbt compile' in '${projectPath}'`);\n    }\n    const manifest = <DbtManifest>(await fs.readJSON(manifestPath));\n    Object.keys(manifest.metrics).forEach(metric => {\n      const regex = /^ref\\('(\\S+)'\\)$/;\n      const metricDef = manifest.metrics[metric];\n      const match = metricDef.model.match(regex);\n      if (!match) {\n        throw new UserError(`Expected reference to the model in format ref('model_name') but found '${metricDef.model}'`);\n      }\n      // eslint-disable-next-line prefer-destructuring\n      const modelName = match[1];\n      metricDef.model = modelName.indexOf('.') !== -1 ? modelName : `model.${metricDef.package_name}.${modelName}`;\n    });\n    return this.loadMetricCubesFromNormalizedManifest(manifest, manifestPath, options);\n  }\n\n  public async loadMetricCubesFromDbtCloud(jobId: string | number, authToken: string, options: DbtLoadOptions): Promise<{ [cubeName: string]: any }> {\n    const response = await fetch('https://metadata.cloud.getdbt.com/graphql', {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-dbt-schema-extension/src/Dbt.ts#L126-L162","documentation":"After confirming dbt_project.yml exists, loadMetricCubesFromDbtProject reads target/manifest.json, which dbt only produces after compiling the project. If the manifest is missing, it throws this UserError telling the developer to run 'dbt compile' in the project directory.","triggerScenarios":"Calling loadMetricCubesFromDbtProject on a valid dbt project that has never been compiled, was compiled with 'dbt run --no-write-json', had target/ cleaned (dbt clean, .gitignore of target/ in CI checkout), or whose compile output was written to a non-default target path.","commonSituations":"Fresh CI checkout where target/ is gitignored and 'dbt compile' was not run in the pipeline; new developer cloning the repo; running Cube before the dbt build step; dbt version or profile misconfiguration that silently skipped compilation.","solutions":["Run 'dbt compile' in the dbt project directory before loading metrics in Cube","Ensure CI pipeline runs dbt compile after checkout and before starting Cube","Make sure the manifest lands in <projectPath>/target/manifest.json (or point Cube at the correct target path)","Configure dbt to write the manifest artifact (remove --no-write-json / DBT_WRITE_JSON=false)"],"exampleFix":"// before\ncubejsServer.devServer(); // dbt project never compiled\n// after\nexecSync('cd dbt_analytics && dbt compile');\ncubejsServer.devServer();","handlingStrategy":"validation","validationCode":"const manifest = path.join(projectPath, 'target', 'manifest.json');\nif (!(await fs.pathExists(manifest))) {\n  throw new Error(`manifest.json missing — run 'dbt compile' in ${projectPath} before starting Cube`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await dbt.loadMetricCubesFromDbtProject(projectPath, opts);\n} catch (e) {\n  if (/manifest\\.json' was not found/.test(e.message)) {\n    execSync(`cd ${projectPath} && dbt compile`);\n    await dbt.loadMetricCubesFromDbtProject(projectPath, opts);\n  } else { throw e; }\n}","preventionTips":["Run 'dbt compile' as a pipeline step before starting Cube","Never rely on committing target/; always regenerate artifacts in CI","Avoid 'dbt clean' or --no-write-json before Cube loads the schema","Add a startup check that target/manifest.json exists"],"tags":["dbt","filesystem","build-artifact","workflow"],"backgroundTag":"file-not-found","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}