windmill-labs/windmill · error

Could not create build dir for rust. e: {e}

Error message

Could not create build dir for rust.
e: {e}

What it means

Raised in get_build_dir when create_dir_all fails on any of the target/, registry/ or git/ subdirectories of the per-build Rust cache directory under RUST_CACHE_DIR. It is a filesystem-level failure (permissions, read-only volume, disk full) on the worker host, not a cargo error; the first failing create_dir_all is chained into an anyhow error.

Source

Thrown at backend/windmill-worker/src/rust_executor.rs:384

                    ))
                }
            }
        })
        .unwrap_or((
            format!("{}/build/{}", *RUST_CACHE_DIR, Uuid::new_v4()),
            false,
        ));

    {
        let (t, r, g) = (
            create_dir_all(format!("{}/target", &bd)).await,
            create_dir_all(format!("{}/registry", &bd)).await,
            create_dir_all(format!("{}/git", &bd)).await,
        );

        t.and(r)
            .and(g)
            .map_err(|e| anyhow::anyhow!("Could not create build dir for rust.\ne: {e}"))?;
    }

    if run_sweep {
        // Also run sweep to make sure target isn't using too much disk
        let mut sweep_cmd = Command::new(CARGO_PATH.as_str());
        let sweep_path = format!("{}/bin:{}", CARGO_HOME.as_str(), PATH_ENV.as_str());
        sweep_cmd
            .current_dir(job_dir)
            .env_clear()
            .env("PATH", &sweep_path)
            .env("CARGO_HOME", CARGO_HOME.as_str())
            .env("HOME", HOME_ENV.as_str())
            .env("CARGO_TARGET_DIR", &(bd.clone() + "/target"))
            .env("RUSTUP_HOME", RUSTUP_HOME.as_str())
            .args(["sweep", "--maxsize", SWEEP_MAXSIZE.as_str()])
            .stdout(Stdio::piped())
            .stderr(Stdio::piped());

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check that RUST_CACHE_DIR (and its parent volume) is writable by the worker process
  2. Free disk space or raise the volume size on the worker host
  3. If running in a container, ensure the cache dir is a writable mount and not overlay-locked
  4. Retry the job once — transient NFS/mount glitches can surface here
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at backend/windmill-worker/src/rust_executor.rs:384 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/35f84513dee19d49. Report an issue: GitHub.