rust-lang/rust · error · anyhow::Error

collecting licensing information with REUSE failed

Error message

collecting licensing information with REUSE failed

What it means

Thrown by obtain_spdx_document in collect-license-metadata when the external `reuse` command (invoked with --include-submodules spdx --add-license-concluded --creator-person=bors) exits with a non-zero status. The tool first prints guidance noting that Rust requires specific unreleased REUSE features (linking fsfe/reuse-tool PR #623), then bails.

Source

Thrown at src/tools/collect-license-metadata/src/reuse.rs:46

    Ok(result)
}

fn obtain_spdx_document(reuse_exe: &Path) -> Result<String, Error> {
    let output = Command::new(reuse_exe)
        .args(&["--include-submodules", "spdx", "--add-license-concluded", "--creator-person=bors"])
        .stdout(Stdio::piped())
        .spawn()?
        .wait_with_output()?;

    if !output.status.success() {
        eprintln!();
        eprintln!("Note that Rust requires some REUSE features that might not be present in the");
        eprintln!("release you're using. Make sure your REUSE release includes these PRs:");
        eprintln!();
        eprintln!(" - https://github.com/fsfe/reuse-tool/pull/623");
        eprintln!();
        anyhow::bail!("collecting licensing information with REUSE failed");
    }

    Ok(String::from_utf8(output.stdout)?)
}

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Upgrade REUSE to a version that includes fsfe/reuse-tool PR #623 (and any other linked PRs).
  2. Run the REUSE command manually to see its stderr: `reuse --include-submodules spdx --add-license-concluded --creator-person=bors`.
  3. Ensure REUSE_EXE points at a valid, executable REUSE binary.
  4. Add REUSE-compliant license/copyright headers to any offending files REUSE complains about.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

// Verify REUSE is installed and recent enough before collecting.
let output = Command::new(&reuse_exe).arg("--version").output()?;
if !output.status.success() {
    eprintln!("REUSE_EXE '{:?}' not runnable; install REUSE >= supported version", reuse_exe);
    std::process::exit(1);
}

Try / catch

if let Err(e) = crate::reuse::collect(&reuse_exe, &mut interner) {
    if e.to_string().contains("REUSE failed") {
        eprintln!("{e:#}");
        eprintln!("Upgrade REUSE to include fsfe/reuse-tool PR #623");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: The REUSE binary is too old and lacks required features; REUSE is not installed or not on PATH; REUSE exits non-zero because of a malformed/incomplete licensing state in the repo (e.g. a file with no license info and no default).

Common situations: Using a distro-packaged REUSE that predates the needed PRs; REUSE_EXE points at the wrong binary; a newly added file lacks REUSE-compliant headers; REUSE version mismatch between local and CI environments.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/dbd2bd9f99bc9f56. Report an issue: GitHub.