cube-js/cube · error
internal error building the filtered spec: unresolved {} — r
Error message
internal error building the filtered spec: unresolved {} — re-run without a pattern to get the whole document What it means
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.
Source
Thrown at rust/cube-cli/src/commands/spec.rs:258
/// agent resolves it to nothing. Since this output is meant to be consumed
/// unattended, fail loudly rather than hand back something quietly wrong.
fn check_no_dangling_refs(doc: &Value) -> Result<()> {
let mut refs = BTreeSet::new();
collect_component_refs(doc, &mut refs);
let dangling: Vec<String> = refs
.into_iter()
.filter(|(bucket, name)| {
doc.get("components")
.and_then(|c| c.get(bucket))
.and_then(|b| b.get(name))
.is_none()
})
.map(|(bucket, name)| format!("#/components/{bucket}/{name}"))
.collect();
if !dangling.is_empty() {
bail!(
"internal error building the filtered spec: unresolved {} — \
re-run without a pattern to get the whole document",
dangling.join(", ")
);
}
Ok(())
}
pub async fn command(args: Args, ctx: &Ctx) -> Result<()> {
let spec = ctx.api()?.get("/api/v1/spec", &Vec::new()).await?;
// Unfiltered JSON is the raw document — no reshaping, so it can be piped
// straight into a generator or a validator.
let Some(pattern) = args.pattern.as_deref() else {
if ctx.json {
output::print_json(&spec);
} else {
print_index(&operations(&spec).iter().collect::<Vec<_>>());View on GitHub (pinned to 7d981676b3)
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
Example fix
// before cube spec deployments // after cube spec
Defensive patterns
Strategy: fallback
Try / catch
try {
run(`cube spec ${pattern}`);
} catch (e) {
if (String(e).includes("unresolved")) run("cube spec"); // full document fallback
else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Filtered spec output used for codegen shows missing schema refs; encountering this after a CLI version change or with a very narrow pattern.
Related errors
- no operation matches `{pattern}` — run `cube spec` to list t
- ${pkg} dependency not found. Please run this command from pr
- No app secret found
- Provided token isn't for ${dotCubeCloud.url}
- API URL is empty
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/20a1bf238adadaf4.
Report an issue: GitHub.