{"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":"\n    // https://github.com/NVIDIA/nvapi/blob/7cb76fce2f52de818b3da497af646af1ec16ce27/nvapi_lite_common.h#L180\n    const NVAPI_SHORT_STRING_MAX: usize = 64;\n\n    // https://github.com/NVIDIA/nvapi/blob/7cb76fce2f52de818b3da497af646af1ec16ce27/nvapi_lite_common.h#L235\n    #[allow(non_camel_case_types)]\n    type NvAPI_ShortString = [c_char; NVAPI_SHORT_STRING_MAX];\n\n    // https://github.com/NVIDIA/nvapi/blob/7cb76fce2f52de818b3da497af646af1ec16ce27/nvapi_lite_common.h#L447\n    #[allow(non_camel_case_types)]\n    type NvAPI_SYS_GetDriverAndBranchVersion_t = unsafe extern \"C\" fn(\n        driver_version: *mut c_uint,\n        build_branch_string: *mut NvAPI_ShortString,\n    ) -> c_int;\n\n    pub(super) fn get_driver_version() -> Result<String> {\n        #[cfg(target_pointer_width = \"64\")]\n        let nvidia_dll_name = s!(\"nvapi64.dll\");\n        #[cfg(target_pointer_width = \"32\")]\n        let nvidia_dll_name = s!(\"nvapi.dll\");\n\n        with_dll_library(nvidia_dll_name, |nvidia_dll| unsafe {\n            let nvapi_query_addr = GetProcAddress(nvidia_dll, s!(\"nvapi_QueryInterface\"))\n                .ok_or_else(|| anyhow::anyhow!(\"Failed to get nvapi_QueryInterface address\"))?;\n            let nvapi_query: extern \"C\" fn(u32) -> *mut () = std::mem::transmute(nvapi_query_addr);\n\n            // https://github.com/NVIDIA/nvapi/blob/7cb76fce2f52de818b3da497af646af1ec16ce27/nvapi_interface.h#L41\n            let nvapi_get_driver_version_ptr = nvapi_query(0x2926aaad);\n            if nvapi_get_driver_version_ptr.is_null() {\n                anyhow::bail!(\"Failed to get NVIDIA driver version function pointer\");\n            }\n            let nvapi_get_driver_version: NvAPI_SYS_GetDriverAndBranchVersion_t =\n                std::mem::transmute(nvapi_get_driver_version_ptr);\n\n            let mut driver_version: c_uint = 0;\n            let mut build_branch_string: NvAPI_ShortString = [0; NVAPI_SHORT_STRING_MAX];\n            let result = nvapi_get_driver_version(","sourceCodeStart":1893,"sourceCodeEnd":1929,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/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":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}