{"record":{"id":"37a2b5f097d100a9","repo":"gfx-rs/wgpu","slug":"vkfreedescriptorsets-error-err-please-report-t","errorCode":null,"errorMessage":"vkFreeDescriptorSets error: {err}, please report this error","messagePattern":"vkFreeDescriptorSets error: (.+?), please report this error","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/vulkan/descriptor.rs","lineNumber":239,"sourceCode":"            bucket_key: key,\r\n            pool_index,\r\n        })\r\n    }\r\n\r\n    pub unsafe fn free(&mut self, device: &ash::Device, set: DescriptorSet) {\r\n        let bucket = self.buckets.get_mut(&set.bucket_key).unwrap();\r\n        let pool = bucket.pools.get_mut(set.pool_index).unwrap();\r\n\r\n        let result =\r\n            unsafe { device.free_descriptor_sets(pool.raw, core::slice::from_ref(&set.raw())) };\r\n        if let Err(err) = result {\r\n            // vkFreeDescriptorSets is documented to return:\r\n            // - VK_ERROR_UNKNOWN\r\n            // - VK_ERROR_VALIDATION_FAILED (we shouldn't encounter this one)\r\n            // wgpu-hal doesn't currently report errors in destroy functions.\r\n            // Panic here for now. It might be ok to ignore the error but the\r\n            // proper solution would probably be to lose the device.\r\n            panic!(\"vkFreeDescriptorSets error: {err}, please report this error\");\r\n        }\r\n\r\n        pool.available += 1;\r\n        bucket.available_sets += 1;\r\n        bucket.allocated_sets -= 1;\r\n        if set.bucket_key.update_after_bind {\r\n            self.update_after_bind_descriptors_in_all_pools -= set.bucket_key.counts.total();\r\n        }\r\n\r\n        // Do not immediately destroy empty pools since they might have\r\n        // been recently created.\r\n        // Destroy a pool only if it's empty and we have 1/4th its capacity\r\n        // in other pools.\r\n        // Note that this logic will never destroy the last pool.\r\n        let pool = bucket.pools.last().unwrap();\r\n        if pool.available == pool.capacity\r\n            && bucket.available_sets - pool.capacity > pool.capacity / 4\r\n        {\r","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/descriptor.rs#L221-L257","documentation":"When destroying a descriptor set, the Vulkan backend calls vkFreeDescriptorSets, which is only expected to fail with VK_ERROR_UNKNOWN or a validation-layer error. wgpu-hal does not yet propagate errors from destroy paths, so any unexpected result triggers this panic asking the user to file a bug. It typically indicates a driver bug, double-free/invalid handle, or a validation failure.","triggerScenarios":"Freeing a descriptor set at destroy time where `vkFreeDescriptorSets` returns a non-SUCCESS result, e.g. after the descriptor pool was already destroyed or the set handle became invalid.","commonSituations":"Driver bugs on certain GPUs; running under a validation layer reporting API misuse; resource-destroy ordering problems; corrupted device state after a prior device loss.","solutions":["Reproduce with Vulkan validation layers enabled and inspect the validation message to find the underlying API misuse.","Check whether a recent driver update/downgrade changes the behavior (likely driver bug).","Report the error to the wgpu issue tracker as the message instructs, including the vk::Result value, driver, and GPU.","As a workaround, verify no custom pool/destroy logic frees descriptor sets before wgpu does."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// This is a panic inside wgpu-hal's destroy path; catch it process-wide.\nstd::panic::catch_unwind(|| drop(descriptor_set)); // last resort; resource is likely invalid\n// Preferred: enable Vulkan validation layers in dev to catch the misuse earlier:\n// VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation","preventionTips":["Run with Vulkan validation layers in development to catch descriptor misuse at the call site.","Never manually free or destroy descriptor pools that wgpu manages.","Keep GPU drivers current and note the vk::Result when reporting."],"tags":["vulkan","descriptor-sets","driver-bug","panic"],"backgroundTag":"unexpected-vulkan-result","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}