{"record":{"id":"554d51c28cfcb9dd","repo":"cube-js/cube","slug":"no-operation-matches-pattern-run-cube-spec","errorCode":null,"errorMessage":"no operation matches `{pattern}` — run `cube spec` to list them all","messagePattern":"no operation matches `(.+?)` — run `cube spec` to list them all","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cube-cli/src/commands/spec.rs","lineNumber":286,"sourceCode":"    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<_>>());\n        }\n        return Ok(());\n    };\n\n    let needle = pattern.to_lowercase();\n    let all = operations(&spec);\n    let matched: Vec<&Operation<'_>> = all.iter().filter(|op| op.matches(&needle)).collect();\n\n    if matched.is_empty() {\n        bail!(\"no operation matches `{pattern}` — run `cube spec` to list them all\");\n    }\n\n    if ctx.json {\n        let doc = filtered_document(&spec, &matched);\n        check_no_dangling_refs(&doc)?;\n        output::print_json(&doc);\n    } else {\n        print_index(&matched);\n    }\n    Ok(())\n}\n\nfn print_index(operations: &[&Operation<'_>]) {\n    let rows = operations\n        .iter()\n        .map(|op| {\n            vec![\n                op.method.to_uppercase(),","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube-cli/src/commands/spec.rs#L268-L304","documentation":"`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.","triggerScenarios":"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').","commonSituations":"Exploring the CLI API surface; guessing operation names; pattern written with regex or glob syntax that the substring matcher doesn't support.","solutions":["Run `cube spec` with no pattern to list all operation names","Correct the pattern spelling (matching is a lowercase substring match)","Use a shorter, broader pattern substring"],"exampleFix":"// before\ncube spec deploymentz\n// after\ncube spec deployment","handlingStrategy":"validation","validationCode":"const all = execSync(\"cube spec --json\").toString(); // list operations first\nconst exists = all.toLowerCase().includes(pattern.toLowerCase());\nif (!exists) console.warn(`pattern '${pattern}' matches no operation`);","typeGuard":null,"tryCatchPattern":"try {\n  run(`cube spec ${pattern}`);\n} catch (e) {\n  if (String(e).includes(\"no operation matches\")) run(\"cube spec\");\n  else throw e;\n}","preventionTips":["Run plain `cube spec` to discover exact operation names before filtering","Remember matching is a lowercase substring, not regex/glob","Keep a saved list of operation names in team docs"],"tags":["cli","spec","no-match"],"backgroundTag":"no-matching-operation","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}