{"record":{"id":"76f8b4b86e139667","repo":"cube-js/cube","slug":"model-model-is-not-found","errorCode":null,"errorMessage":"Model '${model}' is not found","messagePattern":"Model '(.+?)' is not found","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-dbt-schema-extension/src/Dbt.ts","lineNumber":234,"sourceCode":"          if (cubeDefs[modelName].dimensions.indexOf(dimension) === -1) {\n            cubeDefs[modelName].dimensions.push(dimension);\n          }\n        });\n\n        if (metricDef.timestamp) {\n          if (cubeDefs[modelName].timeDimensions.indexOf(metricDef.timestamp) === -1) {\n            cubeDefs[modelName].timeDimensions.push(metricDef.timestamp);\n          }\n        }\n      },\n    );\n\n    const toExtend: { [cubeName: string]: any } = {};\n\n    Object.keys(cubeDefs).forEach(model => {\n      const modelDef = manifest.nodes[model];\n      if (!modelDef) {\n        throw new UserError(`Model '${model}' is not found`);\n      }\n      const cubeDef = {\n        sql: () => `SELECT * FROM ${modelDef.relation_name ? modelDef.relation_name : `${this.compiler.contextQuery().escapeColumnName(modelDef.database)}.${this.compiler.contextQuery().escapeColumnName(modelDef.schema)}.${this.compiler.contextQuery().escapeColumnName(modelDef.name)}`}`,\n        fileName: manifestPath,\n\n        measures: cubeDefs[model].metrics.map(metric => ({\n          [camelize(metric.name, true)]: {\n            sql: () => metric.sql,\n            type: mapMetricType(metric.type),\n          },\n        })).reduce((a, b) => ({ ...a, ...b }), {}),\n\n        dimensions: {\n          ...(cubeDefs[model].dimensions.map(dimension => ({\n            [camelize(dimension, true)]: {\n              sql: () => dimension,\n              type: 'string',\n            },","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-dbt-schema-extension/src/Dbt.ts#L216-L252","documentation":"After normalizing metric model references, loadMetricCubesFromNormalizedManifest looks up each model in manifest.nodes to build the cube's SQL. If a model key referenced by metrics is absent from manifest.nodes, it throws this UserError because the cube cannot know the table to select from.","triggerScenarios":"A manifest.json whose metrics reference models not present in the nodes map (metrics exposed from packages whose models were excluded, --select/--exclude dbt selection filtering out the model, partial manifest), or the model reference normalization in step 223 producing a key (e.g. 'model.<package>.<name>') that does not match any nodes key.","commonSituations":"dbt run/compile with --select that omits the model but not its metrics; dbt packages where the manifest omits node details; dbt version mismatch between compile and the extension's expectations; manually truncated manifest.json.","solutions":["Run 'dbt compile' without --select/--exclude filters that drop the model while keeping metrics that reference it","Verify manifest.nodes contains an entry matching the normalized key (model.<package>.<model_name>) for each metric's model","Regenerate manifest.json with a current dbt version compatible with the extension","Check the metric's package_name matches the package of the referenced model"],"exampleFix":"// before\ndbt compile --select +metrics\n// after\ndbt compile --select +metrics+  # include models the metrics depend on","handlingStrategy":"validation","validationCode":"for (const [model, def] of Object.entries(cubeDefs)) {\n  if (!manifest.nodes[model]) {\n    throw new Error(`Metric references model '${model}' missing from manifest.nodes — compile without excluding it`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await dbt.loadMetricCubesFromDbtProject(projectPath, opts);\n} catch (e) {\n  if (/is not found$/.test(e.message)) {\n    console.error(`Model missing from manifest; check dbt --select filters and package_name: ${e.message}`);\n  } else { throw e; }\n}","preventionTips":["Compile dbt without --select/--exclude filters that drop referenced models","Ensure metric package_name matches the package of the referenced model","Use one dbt version across environments to keep manifest shape consistent","Validate that every metric's model key exists in manifest.nodes after compile"],"tags":["dbt","manifest","schema-compilation","missing-data"],"backgroundTag":"missing-reference","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}