{"record":{"id":"e3a3035d38f5f0b4","repo":"astrid-runtime/astrid","slug":"no-capsule-archive-named-hint-capsule-among","errorCode":null,"errorMessage":"no '.capsule' archive named '{hint}.capsule' among [{}]","messagePattern":"no '\\.capsule' archive named '(.+?)\\.capsule' among \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/github_source.rs","lineNumber":140,"sourceCode":"    match names {\n        [] => Ok(None),\n        [_] => Ok(Some(0)),\n        many => {\n            let Some(hint) = name_hint else {\n                bail!(\n                    \"source produced {} .capsule archives but no capsule name to pick one; \\\n                     expected an archive named '<capsule>.capsule'\",\n                    many.len()\n                );\n            };\n            // Match the hint against each candidate's stem via `strip_suffix`\n            // (no per-call allocation) rather than `format!`-ing the target.\n            match many\n                .iter()\n                .position(|n| n.strip_suffix(\".capsule\") == Some(hint))\n            {\n                Some(idx) => Ok(Some(idx)),\n                None => bail!(\n                    \"no '.capsule' archive named '{hint}.capsule' among [{}]\",\n                    many.join(\", \")\n                ),\n            }\n        },\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_strip_version_prefix() {\n        assert_eq!(strip_version_prefix(\"v1.2.3\"), \"1.2.3\");\n        assert_eq!(strip_version_prefix(\"V1.0.0\"), \"1.0.0\");\n        assert_eq!(strip_version_prefix(\"1.0.0\"), \"1.0.0\");\n        assert_eq!(strip_version_prefix(\"v0.0.1-alpha\"), \"0.0.1-alpha\");","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/github_source.rs#L122-L158","documentation":"pick_capsule was given a name hint, but none of the candidate archive names has `<hint>.capsule` as its exact suffix (compared by stripping \".capsule\" and matching the stem). It reports the hint and the full candidate list so the caller can correct the name or see what was actually built.","triggerScenarios":"Calling pick_capsule with name_hint = Some(h) where h does not equal any candidate's stem: the build produced archives with different names (different or renamed capsule, versioned filenames like my-capsule-1.2.0.capsule, wrong casing) than the supplied hint.","commonSituations":"Capsule renamed in its manifest after the install command/alias was written; a build producing version-suffixed archive names; typos in the capsule name; case mismatch on case-sensitive filesystems.","solutions":["Compare the hint against the archive list in the message and re-run with the exact archive stem (e.g. my-capsule not My-Capsule).","Fix the build/CI so the produced archive is named `<capsule>.capsule` exactly (strip version suffixes from the artifact name).","Pass None if there is truly only one archive, or trim the candidate list to one so no hint is needed."],"exampleFix":"// before\npick_capsule(&[\"my-capsule-1.2.0\"], Some(\"my-capsule\"))\n// after\npick_capsule(&[\"my-capsule-1.2.0\"], Some(\"my-capsule-1.2.0\"))  // or emit my-capsule.capsule","handlingStrategy":"validation","validationCode":"// verify the hint matches a candidate before calling:\nlet ok = names.iter().any(|n| n.strip_suffix(\".capsule\") == Some(hint));\nassert!(ok, \"no archive named {hint}.capsule among {names:?}\");","typeGuard":null,"tryCatchPattern":"match pick_capsule(&names, Some(hint)) {\n    Err(e) if e.to_string().contains(\"among [\") => {\n        eprintln!(\"hint {:?} not found; candidates: {:?}\", hint, names);\n    }\n    other => other?,\n}","preventionTips":["Derive the hint from the capsule manifest name, not a hardcoded string.","Name build artifacts exactly `<capsule>.capsule` without version suffixes.","Watch for case mismatches; compare stems case-sensitively."],"tags":["rust","github","naming","match-failure"],"backgroundTag":"resource-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}