{"record":{"id":"a526c18eeb74bab3","repo":"zed-industries/zed","slug":"invalid-release-channel","errorCode":null,"errorMessage":"invalid release channel {}","messagePattern":"invalid release channel (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/release_channel/src/lib.rs","lineNumber":40,"sourceCode":"/// library, it vendors each crate separately and builds it in isolation, which\n/// makes the `include_str!` fail.\n///\n/// The build script checks for `$ZED_RELEASE_CHANNEL` and emits the `cfg`\n#[cfg(__do_not_set_zed_release_channel)]\nfn compile_time_release_channel_name() -> String {\n    env!(\"ZED_RELEASE_CHANNEL\").trim().to_string()\n}\n\n#[cfg(not(__do_not_set_zed_release_channel))]\nfn compile_time_release_channel_name() -> String {\n    include_str!(\"../../zed/RELEASE_CHANNEL\").trim().to_string()\n}\n\n#[doc(hidden)]\npub static RELEASE_CHANNEL: LazyLock<ReleaseChannel> =\n    LazyLock::new(|| match ReleaseChannel::from_str(&RELEASE_CHANNEL_NAME) {\n        Ok(channel) => channel,\n        _ => panic!(\"invalid release channel {}\", *RELEASE_CHANNEL_NAME),\n    });\n\n/// The app identifier for the current release channel, Windows only.\n#[cfg(target_os = \"windows\")]\npub fn app_identifier() -> &'static str {\n    match *RELEASE_CHANNEL {\n        ReleaseChannel::Dev => \"Zed-Editor-Dev\",\n        ReleaseChannel::Nightly => \"Zed-Editor-Nightly\",\n        ReleaseChannel::Preview => \"Zed-Editor-Preview\",\n        ReleaseChannel::Stable => \"Zed-Editor-Stable\",\n    }\n}\n\n/// The Git commit SHA that Zed was built at.\n#[derive(Clone, Eq, Debug, PartialEq)]\npub struct AppCommitSha(String);\n\nstruct GlobalAppCommitSha(AppCommitSha);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/release_channel/src/lib.rs#L22-L58","documentation":"The release_channel crate resolves Zed's distribution channel (dev, nightly, preview, stable) once per process. The name comes from the runtime env var ZED_RELEASE_CHANNEL in debug builds, otherwise from the compile-time env var or the zed/RELEASE_CHANNEL file. ReleaseChannel::from_str accepts exactly dev, nightly, preview, stable; any other string makes the RELEASE_CHANNEL LazyLock panic on first access (crates/release_channel/src/lib.rs:40). Note the env-var path does not trim or lowercase, so 'Stable' or a trailing newline also fails.","triggerScenarios":"Running a debug build with ZED_RELEASE_CHANNEL set to anything outside dev/nightly/preview/stable (e.g. beta, local, 'stable\\n', 'Stable'); building a release binary with the compile-time env var or zed/RELEASE_CHANNEL file containing such a value. The panic is lazy: it fires on first touch of RELEASE_CHANNEL, e.g. updater checks, telemetry, or app-id setup.","commonSituations":"CI or distro packaging scripts exporting their own channel name; forks renaming the channel without extending the enum; an env var leaking from an unrelated build step in the same shell; editing zed/RELEASE_CHANNEL while experimenting.","solutions":["Set ZED_RELEASE_CHANNEL to a supported value (dev, nightly, preview, or stable, lowercase, no extra whitespace) or unset it so the checked-in zed/RELEASE_CHANNEL file is used.","For debug builds, check your current shell: printenv ZED_RELEASE_CHANNEL — the value is read at runtime, not only build time.","Verify zed/RELEASE_CHANNEL contains exactly one of the four names if the env var is not set.","If a custom channel is genuinely needed, extend ReleaseChannel::from_str and all match arms instead of feeding an unknown string."],"exampleFix":"# before\nZED_RELEASE_CHANNEL=beta cargo run\n# panics: invalid release channel beta\n\n# after\nunset ZED_RELEASE_CHANNEL\ncargo run","handlingStrategy":"validation","validationCode":"#!/bin/sh\ncase \"${ZED_RELEASE_CHANNEL:-}\" in\n  \"\"|dev|nightly|preview|stable) ;;\n  *) echo \"invalid ZED_RELEASE_CHANNEL: '$ZED_RELEASE_CHANNEL'\" >&2; exit 1 ;;\nesac\ncargo build \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize the channel choice in one CI variable and validate it before invoking cargo.","Remember debug builds read ZED_RELEASE_CHANNEL at runtime — check printenv when a dev build panics on launch.","Add real enum variants when a new channel is needed; never feed unlisted strings.","Treat zed/RELEASE_CHANNEL as build input, not an editable scratch file."],"tags":["release-channel","build-configuration","env-var","startup-panic","zed"],"backgroundTag":"invalid-build-configuration","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}