{"record":{"id":"9a407cb744d27034","repo":"astrid-runtime/astrid","slug":"unsupported-linux-target-environment-env","errorCode":null,"errorMessage":"Unsupported Linux target environment: {env}","messagePattern":"Unsupported Linux target environment: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/self_update/mod.rs","lineNumber":122,"sourceCode":"    if cfg!(target_env = \"gnu\") {\n        \"gnu\"\n    } else if cfg!(target_env = \"musl\") {\n        \"musl\"\n    } else {\n        \"\"\n    }\n}\n\nfn platform_target_for(os: &str, arch: &str, target_env: &str) -> anyhow::Result<&'static str> {\n    match (os, arch, target_env) {\n        (\"macos\", \"aarch64\", _) => Ok(\"aarch64-apple-darwin\"),\n        (\"macos\", \"x86_64\", _) => Ok(\"x86_64-apple-darwin\"),\n        (\"linux\", \"x86_64\", \"musl\") => Ok(\"x86_64-unknown-linux-musl\"),\n        (\"linux\", \"aarch64\", \"musl\") => Ok(\"aarch64-unknown-linux-musl\"),\n        (\"linux\", \"x86_64\", \"gnu\") => Ok(\"x86_64-unknown-linux-gnu\"),\n        (\"linux\", \"aarch64\", \"gnu\") => Ok(\"aarch64-unknown-linux-gnu\"),\n        (\"linux\", \"x86_64\" | \"aarch64\", env) => {\n            bail!(\"Unsupported Linux target environment: {env}\")\n        },\n        (\"windows\", \"x86_64\", _) => Ok(\"x86_64-pc-windows-msvc\"),\n        (\"windows\", arch, _) => bail!(\"Unsupported Windows architecture: {arch}\"),\n        _ => bail!(\"Unsupported platform: {os}/{arch}\"),\n    }\n}\n\n/// Resolved path of the currently-running `astrid` binary (symlinks followed) —\n/// what self-update replaces in place.\nfn running_binary() -> anyhow::Result<PathBuf> {\n    let exe = std::env::current_exe().context(\"cannot determine current executable path\")?;\n    Ok(exe.canonicalize().unwrap_or(exe))\n}\n\n/// Whether `exe` is a Homebrew-managed binary. Homebrew symlinks `bin/astrid`\n/// into `…/Cellar/astrid/<version>/bin/astrid`, so the resolved path always\n/// contains a `Cellar` component. Such installs update via `brew upgrade`, not\n/// self-update — we must not shadow them with a second copy.","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/self_update/mod.rs#L104-L140","documentation":"`platform_target_for` maps the running OS/arch/libc to a release target triple. On Linux, only x86_64 and aarch64 with musl or gnu environments are supported; a recognized arch with any other libc identifier (or an unrecognized env) bails with this message. It prevents downloading a binary that would not run on the host.","triggerScenarios":"`astrid self update` on a Linux host whose detected (arch, libc env) tuple is not one of (x86_64|aarch64, musl|gnu) — e.g. musl detection failing on a glibc box, an exotic libc, or env detection returning something like \"gnueabi\" or \"ohos\".","commonSituations":"Running on less common distros (Alpine edge, Android/Termux, Yocto builds) where the libc env string isn't exactly \"musl\" or \"gnu\"; custom toolchain reporting an unusual target env; running under emulation with an odd detected triple.","solutions":["Check `rustc -vV` / `uname -m` to see the detected target and env string.","Install the official binary for the closest supported triple (x86_64/aarch64 gnu or musl) manually instead of self-update.","If your env is genuinely gnu/musl but misdetected, update the env-detection code that feeds platform_target_for.","Add a match arm for the new env in platform_target_for and publish artifacts for it."],"exampleFix":"// before\n(\"linux\", \"x86_64\" | \"aarch64\", env) => bail!(\"Unsupported Linux target environment: {env}\"),\n// after\n(\"linux\", \"armv7\", \"gnueabihf\") => Ok(\"armv7-unknown-linux-gnueabihf\"),\n(\"linux\", \"x86_64\" | \"aarch64\", env) => bail!(\"Unsupported Linux target environment: {env}\"),","handlingStrategy":"fallback","validationCode":"# detect before running self-update\necho \"arch=$(uname -m) libc=$(ldd --version 2>&1 | head -1 | grep -q musl && echo musl || echo gnu)\"","typeGuard":"fn supported_linux_target(arch: &str, env: &str) -> bool {\n    matches!((arch, env), (\"x86_64\" | \"aarch64\", \"musl\" | \"gnu\"))\n}","tryCatchPattern":"match platform_target() {\n    Ok(t) => download(t),\n    Err(e) if e.to_string().contains(\"Unsupported Linux target\") => {\n        eprintln!(\"install the closest supported triple (x86_64/aarch64 gnu or musl) manually\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check `rustc -vV` target triple before self-update on unusual distros.","On exotic libcs, install binaries manually rather than using self-update.","Keep libc-env detection aligned with the triples you actually publish.","Publish artifacts for every triple your match arms accept."],"tags":["platform","self-update","linux","libc","rust"],"backgroundTag":"unsupported-platform","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}