DioxusLabs/dioxus · error
const vec capacity exceeded
Error message
const vec capacity exceeded
What it means
ConstVec is backed by a fixed MAX_SIZE array. Pushing more elements than that capacity (commonly via extend in const contexts) exceeds the backing storage and triggers this panic, since const code cannot grow an allocation.
Solutions
- The const vec is at its fixed capacity. Increase the capacity parameter or push fewer elements.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/dioxus-const-vec/src/lib.rs:152 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/31409f8afcf340f5.
Report an issue: GitHub.
Appendix: source
Thrown at packages/dioxus-const-vec/src/lib.rs:152
}
}
/// Push a value onto the end of the [`ConstVec`].
///
/// # Example
///
/// ```rust
/// # use dioxus_const_vec::ConstVec;
/// const ONE: ConstVec<u8> = {
/// let mut vec = ConstVec::new();
/// vec.push(1);
/// vec
/// };
/// assert_eq!(ONE.as_ref(), &[1]);
/// ```
pub const fn push(&mut self, value: T) {
if self.len as usize >= MAX_SIZE {
panic!("const vec capacity exceeded");
}
self.memory[self.len as usize] = MaybeUninit::new(value);
self.len += 1;
}
/// Extend the [`ConstVec`] with the contents of a slice.
///
/// # Example
///
/// ```rust
/// # use dioxus_const_vec::ConstVec;
/// const ONE: ConstVec<u8> = {
/// let mut vec = ConstVec::new();
/// vec.extend(&[1, 2, 3]);
/// vec
/// };
/// assert_eq!(ONE.as_ref(), &[1, 2, 3]);
/// ```View on GitHub (pinned to 24f6a829df)