cube-js/cube · error

no deployable files found in {}

Error message

no deployable files found in {}

What it means

Raised by `cube deploy` after path validation: the directory exists, but walking it (collect_files) found zero deployable files matching the expected data-model patterns. The CLI refuses an empty upload rather than wiping or no-oping the deployment's data model.

Source

Thrown at rust/cube-cli/src/commands/deploy.rs:81

fn sha1_hex(data: &[u8]) -> String {
    let mut hasher = Sha1::new();
    hasher.update(data);
    format!("{:x}", hasher.finalize())
}

pub async fn command(args: Args, ctx: &Ctx) -> Result<()> {
    let api = ctx.api()?;
    let deployment = args.deployment;
    let base = format!("/build/api/v1/deployments/{deployment}/data-model");

    if !args.directory.is_dir() {
        bail!("{} is not a directory", args.directory.display());
    }
    let mut files = Vec::new();
    collect_files(&args.directory, &args.directory, &mut files)?;
    if files.is_empty() {
        bail!("no deployable files found in {}", args.directory.display());
    }
    files.sort();

    // Hash local files and diff against the server's content hashes.
    let mut query = Vec::new();
    util::push(&mut query, "branchName", &args.branch);
    let upstream = api.get(&format!("{base}/file-hashes"), &query).await?;
    let upstream = upstream.get("files").cloned().unwrap_or(upstream);

    let mut manifest = serde_json::Map::new();
    let mut to_upload = Vec::new();
    for (rel, path) in &files {
        let data =
            std::fs::read(path).with_context(|| format!("failed to read {}", path.display()))?;
        let hash = sha1_hex(&data);
        let unchanged = upstream
            .get(rel)
            .and_then(|f| f.get("hash"))

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Point --directory at the folder that actually contains your Cube data-model files.
  2. List the folder contents and confirm schema files (e.g. model .js/.cube/.yml files) are present.
  3. Check any include/exclude patterns or ignore rules that might be filtering every file.
  4. Fix the CI checkout so schema files land in the directory before deploying.

Example fix

// before
cube deploy 42 --directory .            # repo root has no model files
// after
cube deploy 42 --directory ./cube/schema
Defensive patterns

Strategy: validation

Validate before calling

let count = std::fs::read_dir(&dir)?.filter(|e| {
    e.as_ref().ok().map_or(false, |e| {
        let n = e.file_name().to_string_lossy().into_owned();
        n.ends_with(".js") || n.ends_with(".yml") || n.ends_with(".cube")
    })
}).count();
if count == 0 { anyhow::bail!("no model files in {}", dir.display()); }

Try / catch

match result {
    Err(e) if e.to_string().contains("no deployable files found") => {
        // fail the pipeline early with a pointer to the correct schema folder
    }
    other => other?,
}

Prevention

When it happens

Trigger: `cube deploy <deployment> --directory <dir>` where the directory contains none of the recognized deployable files (e.g. no .js/.yml Cube schema files): wrong directory, all files excluded by ignore rules, or an empty scaffolded folder.

Common situations: Pointing at the repo root when schemas live under a subfolder; a .gitignore-like exclusion matching everything; freshly initialized project with no schema files yet; CI checkout that skipped the schema folder (sparse checkout, wrong path filter).

Related errors


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