{"record":{"id":"7dfe2649216f811d","repo":"cube-js/cube","slug":"dbtprojectpath-was-not-found-please-make-sur","errorCode":null,"errorMessage":"'${dbtProjectPath}' was not found. Please make sure '${projectPath}' is a path to the dbt project","messagePattern":"'(.+?)' was not found\\. Please make sure '(.+?)' is a path to the dbt project","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-dbt-schema-extension/src/Dbt.ts","lineNumber":139,"sourceCode":"  sum: 'sum',\n  average: 'avg',\n  min: 'min',\n  max: 'max',\n};\n\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    });","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-dbt-schema-extension/src/Dbt.ts#L121-L157","documentation":"loadMetricCubesFromDbtProject expects projectPath to be the root of a compiled dbt project containing dbt_project.yml. Before reading anything else it joins projectPath with 'dbt_project.yml' and throws this UserError if the file does not exist, indicating the given path is not a dbt project.","triggerScenarios":"Calling Dbt.loadMetricCubesFromDbtProject(projectPath, options) with a directory that has no dbt_project.yml at its root — wrong directory, typo in path, pointing at the repository root or target/ instead of the project root, or dbt project not yet initialized.","commonSituations":"Misconfigured repositoryPath/dbt config in cube.js pointing to the wrong folder; running Cube from a different working directory with a relative path; CI checkout that excludes the dbt project; passing the folder containing target/ rather than the project root itself.","solutions":["Point the configured dbt project path at the directory that directly contains dbt_project.yml","Verify the path with ls <path>/dbt_project.yml (or fs.pathExists) before loading","Fix relative paths by making the path absolute (path.resolve) relative to the process cwd","If the dbt project lives in a subfolder of the repo, include that subfolder in the configured path"],"exampleFix":"// before\nnew Dbt(compiler).loadMetricCubesFromDbtProject('repo', {})\n// after\nnew Dbt(compiler).loadMetricCubesFromDbtProject('repo/dbt_analytics', {})","handlingStrategy":"validation","validationCode":"const fs = require('fs-extra');\nconst p = path.resolve(process.cwd(), dbtProjectPath);\nif (!(await fs.pathExists(path.join(p, 'dbt_project.yml')))) {\n  throw new Error(`${p} is not a dbt project (dbt_project.yml missing)`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await dbt.loadMetricCubesFromDbtProject(projectPath, opts);\n} catch (e) {\n  if (e.message.includes('was not found')) {\n    console.error(`Check DBT project path; resolved: ${path.resolve(projectPath)}`);\n  } else { throw e; }\n}","preventionTips":["Store the dbt project path as an absolute path in config","Verify dbt_project.yml exists at the configured path in deployment smoke tests","Point the path at the project root, not the repo root or target/","Log path.resolve(projectPath) on startup to catch cwd-relative surprises"],"tags":["dbt","filesystem","path-configuration","validation"],"backgroundTag":"file-not-found","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}