{"record":{"id":"ca4cc6d73b771178","repo":"jdx/mise","slug":"swift-does-not-publish-musl-builds","errorCode":null,"errorMessage":"swift does not publish musl builds","messagePattern":"swift does not publish musl builds","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/plugins/core/swift.rs","lineNumber":245,"sourceCode":"\n    /// A lock entry without a `swift_platform` option was written before the\n    /// distro was recorded, so which artifact its checksum describes is\n    /// unknowable. Such entries still pin the version; their checksum and URL\n    /// are ignored and rewritten for this host's distro on install.\n    fn lockfile_options_are_host_specific(&self) -> bool {\n        true\n    }\n\n    async fn resolve_lock_info(\n        &self,\n        tv: &ToolVersion,\n        target: &PlatformTarget,\n    ) -> Result<PlatformInfo> {\n        // Every published Linux build links against glibc, so there is nothing\n        // to lock for a musl target. Fail instead of recording a URL that\n        // doesn't exist, so `mise lock` reports it as skipped.\n        if target.libc() == Some(\"musl\") {\n            bail!(\"swift does not publish musl builds\");\n        }\n        let url = url(tv, target, &resolve_platform(tv, target).await?);\n        // Which distros are published changes from release to release —\n        // `debian12` first appears in 5.10, `ubuntu20.04` is gone by 6.3 — so\n        // ask rather than encode a matrix that would go stale. This keeps a\n        // lockfile from recording an artifact that isn't there.\n        if let Err(err) = HTTP.head(&url).await {\n            bail!(\"swift does not publish {url}: {err}\");\n        }\n        // swift.org publishes no checksum sidecar (only a detached GPG\n        // signature), so a checksum can't be resolved without downloading the\n        // whole ~1GB toolchain. Record the URL the entry describes; the checksum\n        // is filled in when the tool is installed.\n        Ok(PlatformInfo {\n            url: Some(url),\n            ..Default::default()\n        })\n    }","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/plugins/core/swift.rs#L227-L263","documentation":"When resolving lockfile info for a Swift toolchain on a target platform, mise refuses musl libc targets up front: swift.org publishes no musl-linked Linux builds, so there is no artifact URL to lock. Failing here lets `mise lock` report the target as skipped instead of writing a dead URL into the lockfile.","triggerScenarios":"Running `mise lock swift` (or any lock/resolve path hitting resolve_lock_info) with a platform target whose libc is musl — e.g. generating lock entries for a musl-based container or Alpine-style target.","commonSituations":"CI generating lockfiles for multiple targets including musl; a mise.toml/lock workflow targeting Alpine; users assuming swift.org ships musl builds because other languages do.","solutions":["Generate the Swift lockfile only for glibc (gnu) Linux targets and macOS/Windows targets","Use a glibc-based distribution (Debian, Ubuntu, Fedora) for Linux Swift builds","If you need musl-linked Swift, use an alternative distribution channel (e.g. unofficial musl Swift builds) outside mise's swift core plugin"],"exampleFix":"// before: locking for a musl target\nmise lock swift@6.0 --platform linux-musl\n// after: lock glibc targets only\nmise lock swift@6.0 --platform linux-gnu","handlingStrategy":"validation","validationCode":"function isMuslTarget(t) { return /musl/.test(t); }\nif (isMuslTarget(targetTriple)) throw new Error('Skip swift lock generation for musl targets');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only lock swift for gnu/macos/windows targets","Skip musl targets in CI lock-generation matrices","Document that swift.org publishes no musl builds"],"tags":["swift","musl","lockfile","unsupported-platform"],"backgroundTag":"unsupported-platform","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}