gfx-rs/wgpu · error
Only available on WebGPU
Error message
Only available on WebGPU
What it means
Panic in the core buffer-mapped-range's as_uint8array: this method only exists to serve the WebGPU (browser) backend, where mapped memory is a JS Uint8Array; on a native core buffer there is no such array to return, so the trait method is an unreachable stub.
Source
Thrown at wgpu/src/backend/wgpu_core.rs:2844
impl dispatch::BufferMappedRangeInterface for CoreBufferMappedRange {
#[inline]
fn len(&self) -> usize {
self.size
}
#[inline]
unsafe fn read_slice(&self) -> &[u8] {
unsafe { slice::from_raw_parts(self.ptr.as_ptr(), self.size) }
}
#[inline]
unsafe fn write_slice(&mut self) -> WriteOnly<'_, [u8]> {
unsafe { WriteOnly::new(NonNull::slice_from_raw_parts(self.ptr, self.size)) }
}
#[cfg(webgpu)]
fn as_uint8array(&self) -> &js_sys::Uint8Array {
panic!("Only available on WebGPU")
}
}
View on GitHub (pinned to 3e11ff59bf)
Solutions
- Use read_slice()/write_slice() to access native mapped memory instead of as_uint8array
- Only call as_uint8array behind a webgpu backend check
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at wgpu/src/backend/wgpu_core.rs:2844 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/7730b5a8c6104912.
Report an issue: GitHub.