zed-industries/zed · error · Error

Missing env var `ZED_SERVER_URL`

Error message

Missing env var `ZED_SERVER_URL`

What it means

Bailed by copilot_lsp_native_binary_path (copilot.rs:1397) when env::consts::OS is not one of linux, macos, windows — the only platforms for which GitHub publishes a copilot-language-server-* npm package. The function maps OS names to GitHub's platform identifiers (linux/linux, macos/darwin, windows/win32) and has no fallback, so any other target (freebsd, android, ios, ...) aborts server acquisition immediately; this error then propagates through get_copilot_lsp into CopilotServer::Error.

Source

Thrown at script/randomized-test-ci:13

#!/usr/bin/env node --redirect-warnings=/dev/null

const fs = require("fs");
const { randomBytes } = require("crypto");
const { execFileSync } = require("child_process");
const {
  minimizeTestPlan,
  buildTests,
  runTests,
} = require("./randomized-test-minimize");

const { ZED_SERVER_URL } = process.env;
if (!ZED_SERVER_URL) throw new Error("Missing env var `ZED_SERVER_URL`");

main();

async function main() {
  buildTests();

  const seed = randomU64();
  const commit = execFileSync("git", ["rev-parse", "HEAD"], {
    encoding: "utf8",
  }).trim();

  console.log("commit:", commit);
  console.log("starting seed:", seed);

  const planPath = "target/test-plan.json";
  const minPlanPath = "target/test-plan.min.json";
  const failingSeed = runTests({
    SEED: seed,

View on GitHub (pinned to bc538def45)

Solutions

  1. Accept that Copilot is unsupported on this OS — there is no npm package to install; disable the feature (turn edit predictions off) instead of retrying.
  2. Run on a supported OS (Linux, macOS, Windows); for BSDs, use the Linux binary via a Linux jail/compat layer (e.g. FreeBSD Linuxulator) so env::consts::OS reports linux.
  3. If vendoring a self-built language server, patch copilot_lsp_native_binary_path to map your platform to an existing package and provide the binary at the expected path.
  4. Gate the call site so the error is surfaced as a clear 'unsupported platform' message rather than a generic Copilot failure.

Example fix

// before
let binary_path = copilot_lsp_native_binary_path()?;

// after: fail with actionable context before any network work
let binary_path = copilot_lsp_native_binary_path()
    .context("GitHub Copilot only publishes language servers for linux, macos and windows")?;

// or feature-gate the whole flow at build time
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
fn maybe_start_copilot() { /* ... */ }
Defensive patterns

Strategy: validation

Validate before calling

// Check before any Copilot work; this is a compile-target constant, so it
// can also be evaluated once at startup.
fn copilot_platform_supported() -> bool {
    matches!(env::consts::OS, "linux" | "macos" | "windows")
}

Type guard

fn copilot_platform() -> Option<&'static str> {
    match env::consts::OS {
        "linux" => Some("linux"),
        "macos" => Some("darwin"),
        "windows" => Some("win32"),
        _ => None,
    }
}

Try / catch

// Not really catchable at runtime — fail fast at startup with a clear message.
let Some(_platform) = copilot_platform() else {
    anyhow::bail!("Copilot is unsupported on {}", env::consts::OS);
};

Prevention

When it happens

Trigger: Compiling or running the Zed copilot crate on an OS outside the supported trio — e.g. FreeBSD/OpenBSD builds, Android targets, or any custom std target. The check is compile-target-constant, so the error is deterministic per build, never intermittent.

Common situations: Community builds of Zed for FreeBSD; cross-compiling experiments to unusual targets; CI matrix jobs building the copilot crate for a tier-3 platform; embedding the crate in another application that targets a non-desktop OS.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/2c32d48e5165b2b2. Report an issue: GitHub.