{"record":{"id":"892c0dbe25cec27e","repo":"FuelLabs/fuels-rs","slug":"could-not-canonicalize-md-path","errorCode":null,"errorMessage":"could not canonicalize md path","messagePattern":"could not canonicalize md path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/check-docs/src/lib.rs","lineNumber":222,"sourceCode":"        .filter_map(|line| regex.captures(line))\n        .map(|capture| {\n            let path = PathBuf::from(path).join(&capture[1]);\n            path.canonicalize()\n                .unwrap_or_else(|e| panic!(\"could not canonicalize md path: {e} {path:?}\"))\n        })\n        .collect()\n}\n\npub fn validate_md_files(\n    md_files_summary: HashSet<PathBuf>,\n    md_files_in_src: String,\n) -> Vec<Error> {\n    md_files_in_src\n        .lines()\n        .filter_map(|file| {\n            let file = PathBuf::from(file)\n                .canonicalize()\n                .expect(\"could not canonicalize md path\");\n\n            (!md_files_summary.contains(&file))\n                .then(|| anyhow!(\"file `{}` not in SUMMARY.md\", file.to_str().unwrap()))\n        })\n        .collect()\n}\n\npub fn search_for_pattern(pattern: &str, location: &str) -> anyhow::Result<String> {\n    let grep_project = std::process::Command::new(\"grep\")\n        .arg(\"-H\") // print filename\n        .arg(\"-n\") // print line-number\n        .arg(\"-r\") // search recursively\n        .arg(\"--binary-files=without-match\")\n        .arg(\"--exclude-dir=check-docs\")\n        .arg(pattern)\n        .arg(location)\n        .output()\n        .expect(\"failed grep command\");","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/scripts/check-docs/src/lib.rs#L204-L240","documentation":"check-docs (the docs CI helper) collects markdown files found under src and canonicalizes each path to compare it against the files referenced in SUMMARY.md. The expect fires when canonicalize fails: the path does not exist (deleted/renamed file, typo, dangling symlink) or a parent directory is unreadable.","triggerScenarios":"A .md path returned by the file listing that cannot be canonicalized: files moved or deleted between listing and validation, broken symlinks inside src, or running the script from a working directory where the relative paths do not resolve.","commonSituations":"Docs CI after renaming markdown files; symlinks in monorepos; running the script manually from a subdirectory instead of the repo root.","solutions":["Check the failing path exists (ls) and fix the rename/typo","Fix or remove dangling symlinks under src","Run the script from the repository root the same way CI does"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the listing before comparing against SUMMARY.md\nfor p in md_files_in_src.lines() {\n    let path = std::path::PathBuf::from(p);\n    if !path.exists() {\n        eprintln!(\"missing md file: {p}\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run check-docs from the repository root exactly as CI does","Rename/delete markdown files through the same PR that updates SUMMARY.md","Avoid symlinks inside src, or validate them before running the check"],"tags":["docs","ci","filesystem","scripting"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}