zed-industries/zed · error

instance data needs {required} bytes, above the maximum of {

Error message

instance data needs {required} bytes, above the maximum of {}

What it means

Guard inside `grow_instance_data`: the per-frame GPU instance buffer would need `required` bytes (doubled capacity, power-of-two) above `max_instance_data_size`, so growing is refused. Fires when a single frame's instance data exceeds the compile-time maximum, indicating an unbounded/atlas-sized batch that must be split.

Source

Thrown at crates/gpui_wgpu/src/wgpu_renderer.rs:1934

                    offset: 0,
                    bytes_per_row: Some(INSTANCE_TEXTURE_TEXEL_SIZE as u32),
                    rows_per_image: None,
                },
                wgpu::Extent3d {
                    width: 1,
                    height: 1,
                    depth_or_array_layers: 1,
                },
            );
            break;
        }
    }

    fn grow_instance_data(&mut self, required: u64) -> Result<()> {
        let capacity = (self.instance_data_capacity * 2)
            .max(required.next_power_of_two())
            .min(self.max_instance_data_size);
        anyhow::ensure!(
            capacity >= required,
            "instance data needs {required} bytes, above the maximum of {}",
            self.max_instance_data_size
        );
        anyhow::ensure!(
            capacity > self.instance_data_capacity,
            "frame instance data exceeds the {}-byte maximum",
            self.max_instance_data_size
        );
        log::debug!(
            "instance data grown from {} to {capacity}",
            self.instance_data_capacity
        );
        // Bind groups created earlier in the frame keep the previous buffer or
        // texture alive, so allocations written before the grow remain valid;
        // only subsequent writes land in the new allocation.
        let uses_webgl_instance_data = self.uses_webgl_instance_data;
        let resources = self.resources_mut();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Split the frame's instance batches so no single draw exceeds max_instance_data_size.
  2. Raise max_instance_data_size if scenes legitimately need more instances.
  3. Check for pathological geometry counts (e.g. unbounded path tessellation) upstream.
  4. Clamp batch size and flush multiple draw calls within the same buffer.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui_wgpu/src/wgpu_renderer.rs:1934 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/26c30b5102dac308. Report an issue: GitHub.