astrid-runtime/astrid · error
Unsupported Linux target environment: {env}
Error message
Unsupported Linux target environment: {env} What it means
`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.
Source
Thrown at crates/astrid-cli/src/commands/self_update/mod.rs:122
if cfg!(target_env = "gnu") {
"gnu"
} else if cfg!(target_env = "musl") {
"musl"
} else {
""
}
}
fn platform_target_for(os: &str, arch: &str, target_env: &str) -> anyhow::Result<&'static str> {
match (os, arch, target_env) {
("macos", "aarch64", _) => Ok("aarch64-apple-darwin"),
("macos", "x86_64", _) => Ok("x86_64-apple-darwin"),
("linux", "x86_64", "musl") => Ok("x86_64-unknown-linux-musl"),
("linux", "aarch64", "musl") => Ok("aarch64-unknown-linux-musl"),
("linux", "x86_64", "gnu") => Ok("x86_64-unknown-linux-gnu"),
("linux", "aarch64", "gnu") => Ok("aarch64-unknown-linux-gnu"),
("linux", "x86_64" | "aarch64", env) => {
bail!("Unsupported Linux target environment: {env}")
},
("windows", "x86_64", _) => Ok("x86_64-pc-windows-msvc"),
("windows", arch, _) => bail!("Unsupported Windows architecture: {arch}"),
_ => bail!("Unsupported platform: {os}/{arch}"),
}
}
/// Resolved path of the currently-running `astrid` binary (symlinks followed) —
/// what self-update replaces in place.
fn running_binary() -> anyhow::Result<PathBuf> {
let exe = std::env::current_exe().context("cannot determine current executable path")?;
Ok(exe.canonicalize().unwrap_or(exe))
}
/// Whether `exe` is a Homebrew-managed binary. Homebrew symlinks `bin/astrid`
/// into `…/Cellar/astrid/<version>/bin/astrid`, so the resolved path always
/// contains a `Cellar` component. Such installs update via `brew upgrade`, not
/// self-update — we must not shadow them with a second copy.View on GitHub (pinned to affd8760f4)
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.
Example fix
// before
("linux", "x86_64" | "aarch64", env) => bail!("Unsupported Linux target environment: {env}"),
// after
("linux", "armv7", "gnueabihf") => Ok("armv7-unknown-linux-gnueabihf"),
("linux", "x86_64" | "aarch64", env) => bail!("Unsupported Linux target environment: {env}"), Defensive patterns
Strategy: fallback
Validate before calling
# detect before running self-update echo "arch=$(uname -m) libc=$(ldd --version 2>&1 | head -1 | grep -q musl && echo musl || echo gnu)"
Type guard
fn supported_linux_target(arch: &str, env: &str) -> bool {
matches!((arch, env), ("x86_64" | "aarch64", "musl" | "gnu"))
} Try / catch
match platform_target() {
Ok(t) => download(t),
Err(e) if e.to_string().contains("Unsupported Linux target") => {
eprintln!("install the closest supported triple (x86_64/aarch64 gnu or musl) manually");
}
Err(e) => return Err(e),
} Prevention
- 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.
When it happens
Trigger: `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".
Common situations: 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.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Unsupported Windows architecture: {arch}
- Unsupported platform: {os}/{arch}
- {label} download failed: HTTP {status}
- cannot remove capsule authority while an install transaction
- an incomplete capsule authority update exists at {}; remove
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/9a407cb744d27034.
Report an issue: GitHub.