emilk/egui · error

LayoutJob has no sections

Error message

LayoutJob has no sections

What it means

Error "LayoutJob has no sections" thrown in emilk/egui.

Source

Thrown at crates/epaint/src/text/text_layout_types.rs:230

            return;
        }

        self.sections.push(LayoutSection {
            leading_space,
            byte_range,
            format,
        });
    }

    /// The [`TextFormat`] of the section containing the character starting at the given byte index.
    ///
    /// If the index is past the end, the format of the last section is returned.
    ///
    /// Panics if the job has no sections.
    /// Assumes [`LayoutJob::sections`] are ordered by increasing `byte_range` (as produced by [`Self::append`]).
    pub fn format_at_byte(&self, byte_idx: ByteIndex) -> &TextFormat {
        self.debug_sanity_check();
        let last = self.sections.last().expect("LayoutJob has no sections");
        let idx = self
            .sections
            .partition_point(|section| section.byte_range.end <= byte_idx);
        let section = self.sections.get(idx).unwrap_or(last);
        &section.format
    }

    /// Check the [`Self::sections`] invariant: the sections are ordered and together
    /// cover the whole of [`Self::text`] with no gaps and no overlaps.
    ///
    /// Only does anything in debug builds.
    #[cfg_attr(not(debug_assertions), expect(clippy::unused_self))]
    pub fn debug_sanity_check(&self) {
        #[cfg(debug_assertions)]
        {
            if self.sections.is_empty() {
                assert!(
                    self.text.is_empty(),

View on GitHub (pinned to d802a982ce)

When it happens

Trigger: Thrown at crates/epaint/src/text/text_layout_types.rs:230 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/47722846cc17ea3e. Report an issue: GitHub.