cube-js/cube · error · UserError
'${manifestPath}' was not found. Please run 'dbt compile' in
Error message
'${manifestPath}' was not found. Please run 'dbt compile' in '${projectPath}' What it means
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.
Source
Thrown at packages/cubejs-dbt-schema-extension/src/Dbt.ts:144
function mapMetricType(dbtMetricType: string): string {
if (!dbtToCubeMetricTypeMap[dbtMetricType]) {
throw new UserError(`Unsupported dbt metric type '${dbtMetricType}'`);
}
return dbtToCubeMetricTypeMap[dbtMetricType];
}
export class Dbt extends AbstractExtension {
public async loadMetricCubesFromDbtProject(projectPath: string, options: DbtLoadOptions): Promise<{ [cubeName: string]: any }> {
const dbtProjectPath = path.join(projectPath, 'dbt_project.yml');
if (!(await fs.pathExists(dbtProjectPath))) {
throw new UserError(`'${dbtProjectPath}' was not found. Please make sure '${projectPath}' is a path to the dbt project`);
}
// TODO read target path from dbt_project.yml
const manifestPath = path.join(projectPath, 'target', 'manifest.json');
if (!(await fs.pathExists(manifestPath))) {
throw new UserError(`'${manifestPath}' was not found. Please run 'dbt compile' in '${projectPath}'`);
}
const manifest = <DbtManifest>(await fs.readJSON(manifestPath));
Object.keys(manifest.metrics).forEach(metric => {
const regex = /^ref\('(\S+)'\)$/;
const metricDef = manifest.metrics[metric];
const match = metricDef.model.match(regex);
if (!match) {
throw new UserError(`Expected reference to the model in format ref('model_name') but found '${metricDef.model}'`);
}
// eslint-disable-next-line prefer-destructuring
const modelName = match[1];
metricDef.model = modelName.indexOf('.') !== -1 ? modelName : `model.${metricDef.package_name}.${modelName}`;
});
return this.loadMetricCubesFromNormalizedManifest(manifest, manifestPath, options);
}
public async loadMetricCubesFromDbtCloud(jobId: string | number, authToken: string, options: DbtLoadOptions): Promise<{ [cubeName: string]: any }> {
const response = await fetch('https://metadata.cloud.getdbt.com/graphql', {View on GitHub (pinned to 7d981676b3)
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)
Example fix
// before
cubejsServer.devServer(); // dbt project never compiled
// after
execSync('cd dbt_analytics && dbt compile');
cubejsServer.devServer(); Defensive patterns
Strategy: validation
Validate before calling
const manifest = path.join(projectPath, 'target', 'manifest.json');
if (!(await fs.pathExists(manifest))) {
throw new Error(`manifest.json missing — run 'dbt compile' in ${projectPath} before starting Cube`);
} Try / catch
try {
await dbt.loadMetricCubesFromDbtProject(projectPath, opts);
} catch (e) {
if (/manifest\.json' was not found/.test(e.message)) {
execSync(`cd ${projectPath} && dbt compile`);
await dbt.loadMetricCubesFromDbtProject(projectPath, opts);
} else { throw e; }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- '${dbtProjectPath}' was not found. Please make sure '${proje
- Unable to find package.json file in current working director
- Unable to find ${name} from path: "${value}"
- Stream init error
- Unsupported dbt metric type '${dbtMetricType}'
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/df0b0b024cb7c878.
Report an issue: GitHub.