zed-industries/zed · error · Error

Unexpected response structure: ${JSON.stringify(data)}

Error message

Unexpected response structure: ${JSON.stringify(data)}

What it means

Bailed by get_copilot_lsp (copilot.rs:1389) after the whole acquisition sequence succeeded or was skipped: it queried the latest @github/copilot-language-server version from npm, computed binary_path via copilot_lsp_native_binary_path(), optionally ran npm_install_latest_packages, and then fs.is_file(&binary_path) is still false. It means the install pipeline reported success (or decided no install was needed) yet the platform-specific executable at <copilot_dir>/node_modules/@github/copilot-language-server-<platform>-<arch>/<exe> is absent. This becomes the {error} stored in CopilotServer::Error, later resurfaced by as_running.

Source

Thrown at script/get-release-notes-since:100

      },
      body: JSON.stringify({
        query,
        variables: { owner: "zed-industries", repo: "zed", cursor },
      }),
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();

    if (data.errors) {
      throw new Error(`GraphQL error: ${JSON.stringify(data.errors)}`);
    }

    if (!data.data || !data.data.repository || !data.data.repository.releases) {
      throw new Error(`Unexpected response structure: ${JSON.stringify(data)}`);
    }

    const releases = data.data.repository.releases.nodes;
    allReleases = allReleases.concat(releases);

    hasNextPage = data.data.repository.releases.pageInfo.hasNextPage;
    cursor = data.data.repository.releases.pageInfo.endCursor;

    lastReleaseOnPage = releases[releases.length - 1];

    if (
      releases.length > 0 &&
      new Date(lastReleaseOnPage.createdAt) < startDate
    ) {
      break;
    }
  }

View on GitHub (pinned to bc538def45)

Solutions

  1. Run copilot: Reinstall (reinstall() at copilot.rs:841) — it clears the copilot directory and reinstalls from scratch, fixing stale/corrupt layouts.
  2. Manually delete the copilot dir (paths::copilot_dir(), e.g. ~/.local/share/Zed/copilot on Linux, ~/Library/Application Support/Zed/copilot on macOS) and restart Zed.
  3. On Windows, add an antivirus exclusion for the Zed data directory or restore the quarantined copilot-language-server.exe.
  4. Check disk space and write permissions on the data directory.
  5. Verify the expected path exists after install: node_modules/@github/copilot-language-server-<platform>-<arch>/copilot-language-server[.exe]; if the npm package changed its layout, update Zed to a version tracking the new layout.

Example fix

// before: treating a missing binary as fatal
let path = get_copilot_lsp(fs, node_runtime).await?;

// after: clear the stale install once, then retry before giving up
match get_copilot_lsp(fs.clone(), node_runtime.clone()).await {
    Err(err) if err.to_string().contains("binary was not installed") => {
        clear_copilot_dir().await;
        get_copilot_lsp(fs, node_runtime).await?
    }
    result => result?,
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: verify the expected native binary path exists before starting.
// (mirror of copilot_lsp_native_binary_path's layout)
fn installed_binary_present(fs: &Arc<dyn Fs>) -> bool {
    copilot_lsp_native_binary_path()
        .map(|p| fs.metadata_sync(&p).is_ok())
        .unwrap_or(false)
}

Type guard

fn copilot_install_healthy(fs: &Arc<dyn Fs>) -> bool {
    matches!(copilot_lsp_native_binary_path(), Ok(path) if fs.is_file_sync(&path))
}

Try / catch

// Missing-binary is the classic case for clear-then-reinstall, one retry.
let attempt = get_copilot_lsp(fs.clone(), node_runtime.clone()).await;
let path = match attempt {
    Ok(path) => path,
    Err(err) if err.to_string().contains("binary was not installed") => {
        clear_copilot_dir().await;
        get_copilot_lsp(fs, node_runtime).await?
    }
    Err(err) => return Err(err),
};

Prevention

When it happens

Trigger: npm install completing without error but the package layout not containing the expected native binary path (version layout change); should_install evaluating false because should_install_npm_package saw the language-server.js marker file, while the native binary specifically is missing; fs.is_file failing due to permissions; antivirus quarantining the executable on Windows; partially written copilot dir.

Common situations: Upgrading from an older Zed whose installed package version predates the native-binary layout (marker file present, binary absent); Windows Defender/antivirus removing copilot-language-server.exe; corrupted or half-deleted paths::copilot_dir() after a crash; disk-full during npm unpack; npm cache serving a truncated package.

Related errors


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