{"record":{"id":"05ce370698316364","repo":"jdx/mise","slug":"swiftpm-artifact-bundles-require-a-release-version","errorCode":null,"errorMessage":"SwiftPM artifact bundles require a release version; {display_version} selects a Git revision and must be built from source","messagePattern":"SwiftPM artifact bundles require a release version; (.+?) selects a Git revision and must be built from source","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/backend/spm.rs","lineNumber":645,"sourceCode":"        ToolRequest::Ref { ref_, ref_type, .. } if matches!(ref_type.as_str(), \"ref\" | \"rev\") => {\n            Some(PackageRevision::Git(ref_.clone()))\n        }\n        _ => None,\n    }\n}\n\nfn should_try_artifactbundle(\n    revision: &PackageRevision,\n    opts: &SpmOptions<'_>,\n    mode: ArtifactBundleMode,\n    artifactbundle_only: bool,\n    display_version: &str,\n) -> eyre::Result<bool> {\n    if mode == ArtifactBundleMode::SourceOnly && artifactbundle_only {\n        bail!(\"artifactbundle = false conflicts with spm.artifactbundle_only\");\n    }\n    if revision.is_git_revision() && (opts.requires_artifactbundle(mode) || artifactbundle_only) {\n        bail!(\n            \"SwiftPM artifact bundles require a release version; {display_version} selects a Git revision and must be built from source\"\n        );\n    }\n    Ok(!revision.is_git_revision() && mode != ArtifactBundleMode::SourceOnly)\n}\n\nfn with_install_env(mut command: Expression, tv: &ToolVersion) -> Expression {\n    for (key, value) in tv.install_env() {\n        command = match value.into_string() {\n            Some(value) => command.env(key, value),\n            None => command.env_remove(key),\n        };\n    }\n    command\n}\n\n/// Restricts `executables` to those listed in `filter_bins`, preserving the\n/// original declaration order from `Package.swift` rather than the order in","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/spm.rs#L627-L663","documentation":"SwiftPM artifact bundles are published per release version, so a request that resolves to a Git revision (branch, tag:ref, commit, `ref:...`) can never have one. When bundles are required (artifactbundle = true / artifactbundle_asset set / spm.artifactbundle_only) and the requested version is a git revision, mise aborts instead of pretending to look.","triggerScenarios":"`version = \"ref:main\"` or `version = \"HEAD\"` on an spm tool that also sets `artifactbundle = true`, or under a global `artifactbundle_only` policy.","commonSituations":"Tracking a repo's main branch for a fix, or pinning a commit hash, while bundles-only mode is on from a team policy.","solutions":["Pin a real release version (e.g. \"1.2.3\") so a matching bundle can be selected","Remove the bundle requirement (artifactbundle/artifactbundle_asset) or the spm.artifactbundle_only setting so the git revision builds from source","If you need bundles for unreleased changes, ask upstream to cut a release or build locally without the bundle constraint"],"exampleFix":"# before\n[tools.\"spm:foo/bar\"]\nversion = \"ref:main\"\nartifactbundle = true\n\n# after\n[tools.\"spm:foo/bar\"]\nversion = \"1.2.3\"\nartifactbundle = true","handlingStrategy":"fallback","validationCode":"case \"$version\" in ref:*|HEAD|*:main|*:master) echo 'git revision: cannot use with artifactbundle requirement';; esac","typeGuard":"fn is_git_revision(v: &str) -> bool { v.starts_with(\"ref:\") || v == \"HEAD\" || v.contains(':') }","tryCatchPattern":null,"preventionTips":["Never combine ref:/branch/commit versions with artifactbundle = true or artifactbundle_only","For unreleased changes, allow source builds (no bundle requirement)","Pin release versions when prebuilt bundles are mandatory"],"tags":["spm","swift","git-revision","release-assets","mise-toml"],"backgroundTag":"no-prebuilt-for-version","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}