{"record":{"id":"c931426916c065f7","repo":"FuelLabs/fuels-rs","slug":"no-anchor-available-to-satisfy-include-include","errorCode":null,"errorMessage":"No anchor available to satisfy include {include:?}","messagePattern":"No anchor available to satisfy include (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"scripts/check-docs/src/lib.rs","lineNumber":42,"sourceCode":"        }\n    }\n}\n\npub fn validate_includes(\n    includes: Vec<Include>,\n    valid_anchors: Vec<Anchor>,\n) -> (Vec<Error>, Vec<Error>) {\n    let (pairs, errors): (Vec<_>, Vec<_>) = includes\n        .into_iter()\n        .filter(|include| !include.anchor_name.is_empty())\n        .map(|include| {\n            let mut maybe_anchor = valid_anchors.iter().find(|anchor| {\n                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","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/scripts/check-docs/src/lib.rs#L24-L60","documentation":"Doc-checking script error (scripts/check-docs): a markdown {{#include path:anchor_name}} reference could not be matched to any valid ANCHOR/ANCHOR_END pair. The include directives in markdown files are paired with named anchors embedded in source files; if the target anchor does not exist (wrong name or wrong file), this error is reported with the offending Include's details.","triggerScenarios":"A docs markdown file contains an include line whose anchor_name (4th regex capture) has no matching ANCHOR: <name> ... ANCHOR_END: <name> block in the canonicalized anchor_file — e.g. an anchor was renamed/deleted in the example code, or the include points at the wrong file.","commonSituations":"Refactoring example snippets removes/renames ANCHOR markers while the docs still reference the old name; moving source files so the relative anchor path in the include no longer resolves to the file holding the anchor; copy-pasting an include line and forgetting to update the anchor name.","solutions":["Open the include location reported in the error (include_file + line_no) and read the anchor_name it references.","In the target source file, add ANCHOR: <name> before the snippet and ANCHOR_END: <name> after it, using exactly the referenced name.","If the anchor was renamed, update the markdown include to the new name (or the source back to the old one).","Run cargo run -p check-docs (or the docs CI job) to confirm the pairing now succeeds."],"exampleFix":"// docs/src/contract.md (before)\n{{#include ../../../examples/cookbook/src/lib.rs:missing_anchor}}\n// examples/cookbook/src/lib.rs (after): add matching markers\n// ANCHOR: missing_anchor\npub async fn my_example() { /* ... */ }\n// ANCHOR_END: missing_anchor","handlingStrategy":"validation","validationCode":"use std::fs;\nlet (text, _) = (fs::read_to_string(&md)?, ());\nfor cap in INCLUDE_RE.captures_iter(&text) {\n    let anchor_file = path_from(cap[3]);\n    let src = fs::read_to_string(&anchor_file)?;\n    let name = cap.get(4).map(|m| m.as_str()).unwrap_or(\"\");\n    assert!(\n        src.lines().any(|l| l.contains(&format!(\"ANCHOR: {name}\"))),\n        \"anchor '{name}' missing in {anchor_file:?}\"\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When renaming or deleting an ANCHOR block, grep the docs tree for the old name in the same commit.","Run cargo run -p check-docs in CI and locally before pushing doc changes.","Keep one search pattern (e.g. 'ANCHOR:') handy and audit names on both sides after refactors."],"tags":["docs","check-docs","anchors","markdown","ci"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}