{"record":{"id":"20a1bf238adadaf4","repo":"cube-js/cube","slug":"internal-error-building-the-filtered-spec-unresol","errorCode":null,"errorMessage":"internal error building the filtered spec: unresolved {} — re-run without a pattern to get the whole document","messagePattern":"internal error building the filtered spec: unresolved (.+?) — re-run without a pattern to get the whole document","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cube-cli/src/commands/spec.rs","lineNumber":258,"sourceCode":"/// agent resolves it to nothing. Since this output is meant to be consumed\n/// unattended, fail loudly rather than hand back something quietly wrong.\nfn check_no_dangling_refs(doc: &Value) -> Result<()> {\n    let mut refs = BTreeSet::new();\n    collect_component_refs(doc, &mut refs);\n\n    let dangling: Vec<String> = refs\n        .into_iter()\n        .filter(|(bucket, name)| {\n            doc.get(\"components\")\n                .and_then(|c| c.get(bucket))\n                .and_then(|b| b.get(name))\n                .is_none()\n        })\n        .map(|(bucket, name)| format!(\"#/components/{bucket}/{name}\"))\n        .collect();\n\n    if !dangling.is_empty() {\n        bail!(\n            \"internal error building the filtered spec: unresolved {} — \\\n             re-run without a pattern to get the whole document\",\n            dangling.join(\", \")\n        );\n    }\n    Ok(())\n}\n\npub async fn command(args: Args, ctx: &Ctx) -> Result<()> {\n    let spec = ctx.api()?.get(\"/api/v1/spec\", &Vec::new()).await?;\n\n    // Unfiltered JSON is the raw document — no reshaping, so it can be piped\n    // straight into a generator or a validator.\n    let Some(pattern) = args.pattern.as_deref() else {\n        if ctx.json {\n            output::print_json(&spec);\n        } else {\n            print_index(&operations(&spec).iter().collect::<Vec<_>>());","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube-cli/src/commands/spec.rs#L240-L276","documentation":"An internal-consistency error from `cube spec` with a filter pattern. When the CLI filters the OpenAPI-style spec document down to matching operations, every referenced component schema must also be included; if a $ref still points at a schema that was filtered out, the CLI refuses to emit a broken document and suggests re-running without the pattern.","triggerScenarios":"Running `cube spec <pattern>` where the matched operations reference component schemas the filter failed to include (a CLI bug in reachability computation), or the pattern matches operations with unusual shared schemas.","commonSituations":"Filtered spec output used for codegen shows missing schema refs; encountering this after a CLI version change or with a very narrow pattern.","solutions":["Re-run `cube spec` without a pattern to get the whole document","Try a broader pattern that matches more operations so all shared schemas are included","Upgrade the CLI — this message indicates a bug in the filter logic worth reporting"],"exampleFix":"// before\ncube spec deployments\n// after\ncube spec","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  run(`cube spec ${pattern}`);\n} catch (e) {\n  if (String(e).includes(\"unresolved\")) run(\"cube spec\"); // full document fallback\n  else throw e;\n}","preventionTips":["Prefer the full `cube spec` output when feeding codegen pipelines","Pin a CLI version known to produce consistent filtered specs","Report occurrences — this indicates a CLI bug in reachability filtering"],"tags":["cli","spec","internal-error","openapi"],"backgroundTag":"unresolved-schema-ref","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}