emilk/egui · error

Id must be non-zero.

Error message

Id must be non-zero.

What it means

Error "Id must be non-zero." thrown in emilk/egui.

Source

Thrown at crates/egui/src/id.rs:123

    }

    /// Create a new [`Id`] from a high-entropy value. No hashing is done.
    ///
    /// This can be useful if you have an [`Id`] that was converted to some other type
    /// (e.g. accesskit::NodeId) and you want to convert it back to an [`Id`].
    ///
    /// # Safety
    /// You need to ensure that the value is high-entropy since it might be used in
    /// a [`IdSet`] or [`IdMap`], which rely on the assumption that [`Id`]s have good entropy.
    ///
    /// The method is not unsafe in terms of memory safety.
    ///
    /// # Panics
    /// If the value is zero, this will panic.
    #[doc(hidden)]
    #[expect(unsafe_code)]
    pub unsafe fn from_high_entropy_bits(value: u64) -> Self {
        Self(NonZeroU64::new(value).expect("Id must be non-zero."))
    }
}

impl core::fmt::Debug for Id {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        if *self == Self::NULL {
            return write!(f, "Id::NULL");
        }
        #[cfg(debug_assertions)]
        if let Some(source) = id_source::get(*self) {
            return f.write_str(&source);
        }
        write!(f, "id_{:04X}", self.value() as u16)
    }
}

// ----------------------------------------------------------------------------

View on GitHub (pinned to d802a982ce)

When it happens

Trigger: Thrown at crates/egui/src/id.rs:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of emilk/egui@d802a982ce (2026-08-16). Data as JSON: /api/errors/7c95f39c3382cc84. Report an issue: GitHub.