slint-ui/slint · error

No REUSE.toml file found in current directory

Error message

No REUSE.toml file found in current directory

What it means

check_reuse_compliance requires a REUSE.toml file in the current working directory, since the xtask REUSE workflow is configured per-directory through REUSE.toml. This bail fires early, before even looking for the reuse binary, when the CWD has no REUSE.toml.

Solutions

  1. Run the command from the directory containing REUSE.toml, or ensure the repo root has a REUSE.toml
  2. Create a REUSE.toml declaring copyright/licensing info (see REUSE specification) if none exists
  3. In CI, verify the checkout preserves REUSE.toml before invoking the xtask

Example fix

// before
cd repo && cargo xtask reuse-compliance-check   # no REUSE.toml in repo/
// after
# add a REUSE.toml at the repo root or cd into the directory that has one
printf 'version = 1\n[[annotations]]\npath = ["**"]\nSPDX-FileCopyrightText = "..."\nSPDX-License-Identifier = "..."\n' > REUSE.toml
Defensive patterns

Strategy: validation

Validate before calling

if !std::path::Path::new("REUSE.toml").is_file() {
    eprintln!("Run from a directory containing REUSE.toml");
    std::process::exit(1);
}

Try / catch

match run_reuse_check() {
    Err(e) if e.to_string().contains("No REUSE.toml") => eprintln!("cd into the licensed directory or create REUSE.toml first"),
    other => other?,
}

Prevention

When it happens

Trigger: Running `cargo xtask reuse-compliance-check` from a directory that does not contain REUSE.toml — typically from the repository root when REUSE.toml only exists in subdirectories, or after the file was deleted/renamed.

Common situations: Executing the xtask from the wrong directory; REUSE.toml not yet created for the project; file renamed (e.g. .reuse/dep5 deprecated layout without REUSE.toml); CI checkout step skipped the file.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/bab241a6cd5dbb61. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:364

    Ok(())
}

#[derive(Debug, clap::Parser)]
pub struct ReuseComplianceCheck {
    #[arg(long, action)]
    fix_symlinks: bool,
    #[arg(long, action)]
    download_missing_licenses: bool,
}

impl ReuseComplianceCheck {
    pub fn check_reuse_compliance(&self) -> Result<()> {
        if !std::env::current_dir()
            .context("Can not access current work directory")?
            .join("REUSE.toml")
            .is_file()
        {
            anyhow::bail!("No REUSE.toml file found in current directory");
        }

        let sh = Shell::new()?;

        let reuse = find_reuse().context("Can not find reuse. Please make sure it is installed")?;

        println!("Reuse binary \"{}\".", reuse.to_string_lossy());

        if self.download_missing_licenses {
            let output = reuse_download(&sh, &reuse)?;
            println!("{output}");
        }

        reuse_lint(&sh, &reuse)?;

        scan_symlinks(&sh, &reuse, self.fix_symlinks)
    }
}

View on GitHub (pinned to bb937076de)