{"record":{"id":"7cab9549f7948a84","repo":"gfx-rs/wgpu","slug":"error","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"wgpu-hal/src/vulkan/instance.rs","lineNumber":179,"sourceCode":"        // Set canary and continue\n        crate::VALIDATION_CANARY.add(message.to_string());\n    }\n\n    // We disable this on Apple because there are numerous issues, some of\n    // which raise generic errors that we can't match by VUID. See\n    // <https://github.com/gfx-rs/wgpu/issues/9184> and\n    // <https://github.com/gfx-rs/wgpu/issues/9187>.\n    #[cfg(all(\n        debug_assertions,\n        feature = \"internal_error_panic\",\n        not(target_vendor = \"apple\")\n    ))]\n    if level == log::Level::Error\n        && message_type.contains(vk::DebugUtilsMessageTypeFlagsEXT::VALIDATION)\n        && !cts_error_is_waived(cd.message_id_number)\n    {\n        use alloc::string::ToString as _;\n        panic!(\"{}\", message.to_string());\n    }\n\n    vk::FALSE\n}\n\n/// Validation errors known to fire when running the CTS.\n///\n/// These waivers are keyed off the `WGPU_CTS_XTASK` environment variable, which\n/// is set in `xtask/src/cts.rs`.\n#[cfg(all(\n    debug_assertions,\n    feature = \"internal_error_panic\",\n    not(target_vendor = \"apple\")\n))]\nfn cts_error_is_waived(message_id_number: i32) -> bool {\n    use wgpu_sync::Lazy;\n\n    static WGPU_CTS_XTASK: Lazy<bool> = Lazy::new(|| std::env::var_os(\"WGPU_CTS_XTASK\").is_some());","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/instance.rs#L161-L197","documentation":"The Vulkan debug-utils messenger callback panics when the validation layer reports an Error-level, VALIDATION-type message that is not on the CTS waiver list. Instead of continuing with invalid API state, wgpu turns the validation error into an immediate panic so problems surface at the exact call site. The panic text is the raw validation message.","triggerScenarios":"Any Vulkan API call wgpu makes that a validation layer flags as an Error severity validation message, unless the message_id_number matches a known CTS waiver in `cts_error_is_waived`.","commonSituations":"Developers editing wgpu-hal introducing API misuse; running the CTS on a driver exposing genuine bugs; layer version mismatches flagging previously-legal usage; intentionally triggered during debugging (RUST_BACKTRACE/panic settings).","solutions":["Read the panic text: it is the verbatim Vulkan validation message identifying the offending API call.","Run with validation layers and reproduce to get the call stack of the misused API.","Fix the underlying API misuse in the calling wgpu-hal code (wrong usage flags, invalid bind, sync hazard, etc.).","If the driver is incorrectly reporting a valid operation, verify against the Vulkan spec and update or bypass the layer; a CTS waiver can only be added for known CTS-specific false positives."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure validation layers are on in dev so the panic reproduces with full context:\n// VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_VALIDATION_VALIDATE=1\n// Also check whether the message id is a known waiver:\n// see cts_error_is_waived in wgpu-hal/src/vulkan/instance.rs","typeGuard":null,"tryCatchPattern":"// Panic originates in the driver-message callback; use the panic hook for diagnostics.\nstd::panic::set_hook(Box::new(|info| {\n    log::error!(\"validation panic: {info}\");\n    // attach driver/GPU info and the validation message id\n}));","preventionTips":["Fix validation messages at Warning level early; Error-level ones will panic.","Run the CTS after backend changes.","Verify suspect behavior against the Vulkan spec, not just layer silence.","Keep validation layers updated to reduce false positives."],"tags":["vulkan","validation-layer","debug-messenger","panic"],"backgroundTag":"vulkan-validation-error","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}