zed-industries/zed · error

Failed to get agsInitialize address

Error message

Failed to get agsInitialize address

What it means

Raised in `get_driver_version` when GetProcAddress for `agsInitialize` on amd_ags_x64.dll (or x86) returns null: the AMD AGS DLL was found/loaded but does not export the expected symbol, usually meaning an incompatible or truncated amd_ags DLL version is on the path. Only affects reporting AMD driver versions.

Source

Thrown at crates/gpui_windows/src/directx_renderer.rs:1909

        version: c_int,
        config: *const c_void,
        context: *mut *mut AGSContext,
        gpu_info: *mut AGSGPUInfo,
    ) -> c_int;

    // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/blob/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/inc/amd_ags.h#L436
    #[allow(non_camel_case_types)]
    type agsDeInitialize_t = unsafe extern "C" fn(context: *mut AGSContext) -> c_int;

    pub(super) fn get_driver_version() -> Result<String> {
        #[cfg(target_pointer_width = "64")]
        let amd_dll_name = s!("amd_ags_x64.dll");
        #[cfg(target_pointer_width = "32")]
        let amd_dll_name = s!("amd_ags_x86.dll");

        with_dll_library(amd_dll_name, |amd_dll| unsafe {
            let ags_initialize_addr = GetProcAddress(amd_dll, s!("agsInitialize"))
                .ok_or_else(|| anyhow::anyhow!("Failed to get agsInitialize address"))?;
            let ags_deinitialize_addr = GetProcAddress(amd_dll, s!("agsDeInitialize"))
                .ok_or_else(|| anyhow::anyhow!("Failed to get agsDeInitialize address"))?;

            let ags_initialize: agsInitialize_t = std::mem::transmute(ags_initialize_addr);
            let ags_deinitialize: agsDeInitialize_t = std::mem::transmute(ags_deinitialize_addr);

            let mut context: *mut AGSContext = std::ptr::null_mut();
            let mut gpu_info: AGSGPUInfo = AGSGPUInfo {
                driver_version: std::ptr::null(),
                radeon_software_version: std::ptr::null(),
                num_devices: 0,
                devices: std::ptr::null_mut(),
            };

            let result = ags_initialize(
                AGS_CURRENT_VERSION,
                std::ptr::null(),
                &mut context,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Treat as non-fatal: return an unknown/empty driver version string instead of failing rendering.
  2. Verify the bundled amd_ags_x64.dll version matches the AGS SDK headers used.
  3. Check the DLL architecture matches the process (x64 vs x86).
  4. Log the DLL path to detect a conflicting copy being loaded from PATH.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/gpui_windows/src/directx_renderer.rs:1909 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/4666cac5f00a32b4. Report an issue: GitHub.