{"record":{"id":"9cab735d661763d9","repo":"rust-lang/rust","slug":"unexpected-end-of-input-inside-text-block","errorCode":null,"errorMessage":"unexpected end of input inside <text> block","messagePattern":"unexpected end of input inside <text> block","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/tools/collect-license-metadata/src/spdx/mod.rs","lineNumber":84,"sourceCode":"    };\n\n    // The closing tag might be on the same line.\n    if let Some(content) = start.strip_suffix(\"</text>\") {\n        return Ok(content.to_string());\n    }\n\n    let mut text = start.to_string();\n    for line in further_lines.by_ref() {\n        if let Some(rest) = line.strip_suffix(\"</text>\") {\n            text.push('\\n');\n            text.push_str(rest);\n            return Ok(text);\n        }\n        text.push('\\n');\n        text.push_str(line);\n    }\n\n    anyhow::bail!(\"unexpected end of input inside <text> block\")\n}\n\nfn build_file_entry(\n    name: String,\n    concluded_license: Option<String>,\n    copyright_text: Option<String>,\n) -> Result<SpdxFileEntry, Error> {\n    Ok(SpdxFileEntry {\n        name,\n        concluded_license: concluded_license\n            .ok_or_else(|| anyhow::anyhow!(\"file missing LicenseConcluded\"))?,\n        copyright_text: copyright_text\n            .ok_or_else(|| anyhow::anyhow!(\"file missing FileCopyrightText\"))?,\n    })\n}\n\n#[cfg(test)]\nmod tests;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/tools/collect-license-metadata/src/spdx/mod.rs#L66-L102","documentation":"Thrown by resolve_multiline_value in the SPDX tag-value parser when a value begins with <text> but the iterator of remaining lines ends without a line containing the closing </text> tag. Per the SPDX spec, multi-line values must be wrapped in <text>…</text>; an unclosed tag means the document is truncated or malformed.","triggerScenarios":"REUSE produced an SPDX document where a <text> block (e.g. a multi-line FileCopyrightText) was cut off before its closing tag; the document was truncated in transit or by a buffering issue; an unterminated <text> on the last line of the file.","commonSituations":"REUSE output truncated due to a large repo or a pipe buffer limit; a bug in the REUSE version producing malformed SPDX; manual editing of an SPDX document removing the closing tag.","solutions":["Re-run REUSE to regenerate the SPDX document and check whether the truncation recurs.","Inspect the REUSE stdout around the offending tag to confirm whether the closing </text> is missing or merely split across buffers.","Upgrade REUSE if a known bug produced malformed output.","If parsing a hand-edited SPDX file, add the missing </text> closing tag."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// Quick well-formedness check: every <text> tag has a matching </text>.\nlet opens = input.matches(\"<text>\").count();\nlet closes = input.matches(\"</text>\").count();\nif opens != closes {\n    eprintln!(\"SPDX input has {opens} <text> opens but {closes} </text> closes; likely truncated\");\n}","typeGuard":null,"tryCatchPattern":"match crate::spdx::parse_tag_value(raw) {\n    Ok(files) => files,\n    Err(e) if e.to_string().contains(\"inside <text> block\") => {\n        eprintln!(\"SPDX document appears truncated; regenerate with REUSE.\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Regenerate the SPDX document if it looks truncated.","Stream large REUSE outputs to a file rather than a pipe to avoid buffer truncation.","Upgrade REUSE to fix known SPDX-emission bugs."],"tags":["collect-license-metadata","spdx","parsing","licensing"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}