{"record":{"id":"da9da66347fda28e","repo":"FuelLabs/fuels-rs","slug":"anchor-unused-unused-anchor","errorCode":null,"errorMessage":"Anchor unused: {unused_anchor:?}!","messagePattern":"Anchor unused: (.+?)!","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"scripts/check-docs/src/lib.rs","lineNumber":55,"sourceCode":"                anchor.file == include.anchor_file && anchor.name == include.anchor_name\n            });\n\n            match maybe_anchor.take() {\n                Some(anchor) => Ok(anchor.clone()),\n                None => Err(anyhow!(\n                    \"No anchor available to satisfy include {include:?}\"\n                )),\n            }\n        })\n        .partition_result();\n\n    let additional_warnings = valid_anchors\n        .iter()\n        .filter(|valid_anchor| {\n            let anchor_used_in_a_pair = pairs.iter().any(|anchor| anchor == *valid_anchor);\n            !anchor_used_in_a_pair\n        })\n        .map(|unused_anchor| anyhow!(\"Anchor unused: {unused_anchor:?}!\"))\n        .collect::<Vec<_>>();\n\n    (errors, additional_warnings)\n}\n\n#[allow(dead_code)]\n#[derive(Debug, Clone)]\npub struct Include {\n    pub anchor_name: String,\n    pub anchor_file: PathBuf,\n    pub include_file: PathBuf,\n    pub line_no: usize,\n}\n\npub fn parse_includes(text_w_includes: String) -> (Vec<Include>, Vec<Error>) {\n    let apply_regex = |regex: Regex| {\n        let (includes, errors): (Vec<_>, Vec<_>) = text_w_includes\n            .lines()","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/scripts/check-docs/src/lib.rs#L37-L73","documentation":"Doc-checking warning (scripts/check-docs): a valid ANCHOR/ANCHOR_END pair exists in the source tree but no markdown include references it. It is returned in the warnings vector, not the errors vector, so it flags dead anchors rather than failing the include resolution itself.","triggerScenarios":"After pairing all includes, any valid_anchor not present in the pairs list produces this warning — e.g. an include referencing the anchor was deleted from the docs, or a new ANCHOR block was added in example code without a corresponding {{#include ...}} in markdown.","commonSituations":"Docs reorganization removes a markdown page that used the anchor; example code gains ANCHOR markers 'for later'; the include's anchor_name was changed to point at a different anchor, orphaning the previous one.","solutions":["Decide whether the anchor should still be documented: if yes, add a {{#include file:anchor}} snippet in the appropriate markdown page.","If the anchor is obsolete, delete the ANCHOR:/ANCHOR_END: marker pair from the source file.","If the warning is expected and acceptable locally, note that it is a warning not an error — but treat CI config as authoritative for whether warnings fail the job."],"exampleFix":"// examples/cookbook/src/lib.rs (before)\n// ANCHOR: unused_snippet\nfn helper() {}\n// ANCHOR_END: unused_snippet\n// after: either remove the markers, or reference it in docs/src/page.md\n// {{#include ../../../examples/cookbook/src/lib.rs:unused_snippet}}","handlingStrategy":"validation","validationCode":"// before flagging in review: grep for includes referencing each anchor\n// shell: grep -rn \"#include.*:anchor_name\" docs/src","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete ANCHOR markers in the same commit that removes the doc snippet referencing them.","Periodically run check-docs and treat the unused-anchor warning list as a cleanup backlog.","Name anchors after the example they wrap so stale ones are obvious."],"tags":["docs","check-docs","anchors","cleanup"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}