{"record":{"id":"76c52c1ef3dc4ddb","repo":"espanso/espanso","slug":"unable-to-find-version-for-package","errorCode":null,"errorMessage":"unable to find version: {} for package: {}","messagePattern":"unable to find version: (.+?) for package: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"espanso-package/src/resolver.rs","lineNumber":61,"sourceCode":"\n    if matching_packages.is_empty() {\n        bail!(\"no package found with name: {}\", name);\n    }\n\n    matching_packages.sort_by(|a, b| natord::compare(&a.manifest.version, &b.manifest.version));\n\n    let matching_package = if let Some(explicit_version) = version {\n        matching_packages\n            .into_iter()\n            .find(|package| package.manifest.version == explicit_version)\n    } else {\n        matching_packages.into_iter().next_back()\n    };\n\n    if let Some(matching_package) = matching_package {\n        Ok(matching_package)\n    } else {\n        bail!(\n            \"unable to find version: {} for package: {}\",\n            version.unwrap_or_default(),\n            name\n        );\n    }\n}\n\npub fn resolve_all_packages(base_dir: &Path) -> Result<Vec<ResolvedPackage>> {\n    let manifest_files = find_all_manifests(base_dir)?;\n\n    if manifest_files.is_empty() {\n        bail!(\"no manifests found in base_dir\");\n    }\n\n    let mut manifests = Vec::new();\n\n    for manifest_file in manifest_files {\n        let base_dir = manifest_file","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/espanso/espanso/blob/e6c3736675048026a057f1c4803d59242482fa7b/espanso-package/src/resolver.rs#L43-L79","documentation":"After filtering by name and sorting versions, resolve_package selects either the explicit requested version or the newest. If nothing is selected (usually the explicit version is not among the available ones) it bails with this error naming the version and package.","triggerScenarios":"Calling resolve_package with version=Some(v) where v does not exist for that package in the local manifests (e.g. \"1.2.3\" when only 1.0.0 is installed), or with an empty/absent set that yields no candidate.","commonSituations":"Pinning an old version that has since been removed; typo in the version string; version format mismatch (\"1.2\" vs \"1.2.0\"); package index stale so the newest version is not present locally.","solutions":["List available versions in the package manifests and use an exact existing version string.","Pass version=None to get the latest available version instead of pinning.","Update/refresh the package index or re-download the package to fetch newer versions.","Check version format — versions are compared with natural ordering, so use the exact \"x.y.z\" string from the manifest."],"exampleFix":"// before\nresolve_package(base_dir, \"emoji\", Some(\"2.0.0\"))\n// after\nresolve_package(base_dir, \"emoji\", Some(\"1.6.0\")) // version present in manifests\n// or\nresolve_package(base_dir, \"emoji\", None)","handlingStrategy":"validation","validationCode":"// verify the version exists before pinning\nlet versions: Vec<_> = resolve_all_packages(base_dir)?\n    .iter().filter(|p| p.manifest.name == name)\n    .map(|p| p.manifest.version.clone()).collect();\nif let Some(v) = requested_version { assert!(versions.contains(&v.to_string()), \"version {v} unavailable\"); }","typeGuard":null,"tryCatchPattern":"match resolve_package(base_dir, name, Some(ver)) {\n    Err(e) if e.to_string().contains(\"unable to find version\") => resolve_package(base_dir, name, None),\n    other => other,\n}","preventionTips":["Only pin versions copied verbatim from manifests.","Prefer version=None (latest) unless reproducibility demands pinning.","Refresh the index after upstream releases."],"tags":["package-resolution","version","not-found"],"backgroundTag":"record-not-found","analyzedSha":"e6c3736675048026a057f1c4803d59242482fa7b","analyzedAt":"2026-09-06T15:16:34.240Z","contentChangedAt":"2026-09-06T15:16:34.240Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}