{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/plugins/core/swift.rs","lineNumber":246,"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);\n        // Not every distro/arch pair is published — `ubi9` has no aarch64 build,\n        // for instance — and which pairs exist changes per release, so ask rather\n        // than encode a matrix that would go stale. This keeps a lockfile from\n        // 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":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/plugins/core/swift.rs#L228-L264","documentation":"mise lock resolves a PlatformInfo (URL + checksum) for each tool so lockfiles stay reproducible. For swift on Linux, every swift.org build links against glibc — there is no musl variant — so when the target's libc is musl the resolver fails on purpose instead of recording a URL that does not exist; mise lock then reports swift as skipped rather than writing a bogus entry.","triggerScenarios":"Running `mise lock` (or any flow that resolves lock info) for swift while the platform target's libc is musl: Alpine hosts, distroless/scratch musl containers, Nixpkgs musl runners. resolve_lock_info checks target.libc() == Some(\"musl\") before anything else.","commonSituations":"CI on alpine images with a mise.toml that includes swift; developers on Alpine workstations; lockfile generation for multi-platform matrices where one target is musl-based.","solutions":["Run lock generation on a glibc-based image/host (debian, ubuntu, ubi, amazonlinux) — or exclude that musl target from swift locking","If you genuinely need swift on Alpine, no official build exists: switch the container to a glibc base or use a swift docker image instead of mise-managed swift","Accept the skip: `mise lock` marks swift as skipped on musl — verify the lockfile simply lacks a swift entry and don't force it","For local dev on Alpine, run swift in a glibc container (devcontainer/Docker) rather than via mise"],"exampleFix":"# before (Dockerfile)\nFROM alpine:latest\nRUN mise lock   # -> swift does not publish musl builds\n\n# after\nFROM debian:bookworm-slim\nRUN mise lock","handlingStrategy":"validation","validationCode":"# refuse to lock swift from a musl host, before mise lock:\n[ \"$(ldd --version 2>&1 | head -1 | grep -o musl || true)\" ] && { echo \"swift unavailable on musl; using glibc container\"; exit 1; }\nmise lock","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate lockfiles on glibc images (debian/ubuntu) in CI, not alpine","Check the lock output for skipped tools after `mise lock` — skips are the signal a platform lacks artifacts","Keep swift workloads on official swift containers or glibc bases; don't depend on mise swift under musl"],"tags":["swift","musl","alpine","lockfile","platform-support"],"backgroundTag":"artifact-not-published-for-platform","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}