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

file missing LicenseConcluded

Error message

file missing LicenseConcluded

What it means

Thrown by build_file_entry when a file section in the SPDX document has a FileName but no LicenseConcluded tag was recorded before the next FileName (or end of document). collect-license-metadata requires a concluded license for every file; the REUSE invocation is told --add-license-concluded precisely so this field is populated, so its absence indicates a problem.

Source

Thrown at src/tools/collect-license-metadata/src/spdx/mod.rs:95

            text.push_str(rest);
            return Ok(text);
        }
        text.push('\n');
        text.push_str(line);
    }

    anyhow::bail!("unexpected end of input inside <text> block")
}

fn build_file_entry(
    name: String,
    concluded_license: Option<String>,
    copyright_text: Option<String>,
) -> Result<SpdxFileEntry, Error> {
    Ok(SpdxFileEntry {
        name,
        concluded_license: concluded_license
            .ok_or_else(|| anyhow::anyhow!("file missing LicenseConcluded"))?,
        copyright_text: copyright_text
            .ok_or_else(|| anyhow::anyhow!("file missing FileCopyrightText"))?,
    })
}

#[cfg(test)]
mod tests;

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Ensure REUSE is invoked with --add-license-concluded (as obtain_spdx_document does) and that the version supports it.
  2. Add explicit REUSE license annotations to the offending file so REUSE can conclude a license.
  3. Upgrade REUSE to a current release.
  4. Inspect the SPDX section for the file to see what tags ARE present.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

// Count LicenseConcluded tags vs FileName tags to detect missing licenses up front.
let files = input.lines().filter(|l| l.starts_with("FileName:")).count();
let licenses = input.lines().filter(|l| l.starts_with("LicenseConcluded:")).count();
if licenses < files {
    eprintln!("{files} files but only {licenses} LicenseConcluded tags; some files lack a concluded license");
}

Try / catch

match crate::spdx::parse_tag_value(raw) {
    Err(e) if e.to_string().contains("missing LicenseConcluded") => {
        eprintln!("{e:#}. Ensure REUSE runs with --add-license-concluded and annotations are complete.");
        return Err(e);
    }
    other => other?,
}

Prevention

When it happens

Trigger: REUSE was not run with --add-license-concluded (or the flag had no effect); a file has indeterminable licensing so REUSE omitted LicenseConcluded; an older REUSE version that does not support concluded-license inference.

Common situations: REUSE version too old to infer concluded licenses; a file with conflicting/ambiguous license info that REUSE cannot resolve; the SPDX document was generated by a different tool that omits LicenseConcluded.

Related errors


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