{"record":{"id":"7509119c44f89915","repo":"zed-industries/zed","slug":"failed-to-get-agsdeinitialize-address","errorCode":null,"errorMessage":"Failed to get agsDeInitialize address","messagePattern":"Failed to get agsDeInitialize address","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_windows/src/directx_renderer.rs","lineNumber":1911,"sourceCode":"        context: *mut *mut AGSContext,\n        gpu_info: *mut AGSGPUInfo,\n    ) -> c_int;\n\n    // https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/blob/5d8812d703d0335741b6f7ffc37838eeb8b967f7/ags_lib/inc/amd_ags.h#L436\n    #[allow(non_camel_case_types)]\n    type agsDeInitialize_t = unsafe extern \"C\" fn(context: *mut AGSContext) -> c_int;\n\n    pub(super) fn get_driver_version() -> Result<String> {\n        #[cfg(target_pointer_width = \"64\")]\n        let amd_dll_name = s!(\"amd_ags_x64.dll\");\n        #[cfg(target_pointer_width = \"32\")]\n        let amd_dll_name = s!(\"amd_ags_x86.dll\");\n\n        with_dll_library(amd_dll_name, |amd_dll| unsafe {\n            let ags_initialize_addr = GetProcAddress(amd_dll, s!(\"agsInitialize\"))\n                .ok_or_else(|| anyhow::anyhow!(\"Failed to get agsInitialize address\"))?;\n            let ags_deinitialize_addr = GetProcAddress(amd_dll, s!(\"agsDeInitialize\"))\n                .ok_or_else(|| anyhow::anyhow!(\"Failed to get agsDeInitialize address\"))?;\n\n            let ags_initialize: agsInitialize_t = std::mem::transmute(ags_initialize_addr);\n            let ags_deinitialize: agsDeInitialize_t = std::mem::transmute(ags_deinitialize_addr);\n\n            let mut context: *mut AGSContext = std::ptr::null_mut();\n            let mut gpu_info: AGSGPUInfo = AGSGPUInfo {\n                driver_version: std::ptr::null(),\n                radeon_software_version: std::ptr::null(),\n                num_devices: 0,\n                devices: std::ptr::null_mut(),\n            };\n\n            let result = ags_initialize(\n                AGS_CURRENT_VERSION,\n                std::ptr::null(),\n                &mut context,\n                &mut gpu_info,\n            );","sourceCodeStart":1893,"sourceCodeEnd":1929,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_windows/src/directx_renderer.rs#L1893-L1929","documentation":"Raised in `get_driver_version` when GetProcAddress for `agsDeInitialize` on amd_ags_x64.dll/x86 returns null after (or alongside) the agsInitialize lookup failing: the loaded AMD AGS DLL lacks the expected exports, so the AGS context cannot be safely torn down. Diagnostics-only path for AMD driver version reporting.","triggerScenarios":"Thrown at crates/gpui_windows/src/directx_renderer.rs:1911 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Skip AGS-based version detection and report an unknown driver version.","Bundle a known-good amd_ags DLL matching the AGS SDK headers in use.","Verify symbol names against the AGS SDK version; exports changed across releases.","Do not leak the AGSContext if initialization succeeded but teardown is unavailable — skip AGS entirely in that case."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}