cube-js/cube · error

no operation matches `{pattern}` — run `cube spec` to list t

Error message

no operation matches `{pattern}` — run `cube spec` to list them all

What it means

`cube spec <pattern>` filters the API spec to operations whose name/path matches the given pattern (case-insensitive). If nothing matches, the CLI bails with this message and points to plain `cube spec` to list all available operations.

Source

Thrown at rust/cube-cli/src/commands/spec.rs:286

    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<_>>());
        }
        return Ok(());
    };

    let needle = pattern.to_lowercase();
    let all = operations(&spec);
    let matched: Vec<&Operation<'_>> = all.iter().filter(|op| op.matches(&needle)).collect();

    if matched.is_empty() {
        bail!("no operation matches `{pattern}` — run `cube spec` to list them all");
    }

    if ctx.json {
        let doc = filtered_document(&spec, &matched);
        check_no_dangling_refs(&doc)?;
        output::print_json(&doc);
    } else {
        print_index(&matched);
    }
    Ok(())
}

fn print_index(operations: &[&Operation<'_>]) {
    let rows = operations
        .iter()
        .map(|op| {
            vec![
                op.method.to_uppercase(),

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Run `cube spec` with no pattern to list all operation names
  2. Correct the pattern spelling (matching is a lowercase substring match)
  3. Use a shorter, broader pattern substring

Example fix

// before
cube spec deploymentz
// after
cube spec deployment
Defensive patterns

Strategy: validation

Validate before calling

const all = execSync("cube spec --json").toString(); // list operations first
const exists = all.toLowerCase().includes(pattern.toLowerCase());
if (!exists) console.warn(`pattern '${pattern}' matches no operation`);

Try / catch

try {
  run(`cube spec ${pattern}`);
} catch (e) {
  if (String(e).includes("no operation matches")) run("cube spec");
  else throw e;
}

Prevention

When it happens

Trigger: Running `cube spec deploy` when only 'deployments' operations exist but the substring doesn't match; typos in the operation name; using singular/plural mismatch (e.g. 'schema' vs 'schemas').

Common situations: Exploring the CLI API surface; guessing operation names; pattern written with regex or glob syntax that the substring matcher doesn't support.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/554d51c28cfcb9dd. Report an issue: GitHub.