bevyengine/bevy · warning · TextError

font not found

Error message

font not found

What it means

TextError::NoSuchFont (bevy_text/src/error.rs:8) means a text span's font could not be found: the font asset has not finished loading yet, or it failed to load. The text pipeline returns it when a FontSource::Handle fails to resolve in the Fonts map (pipeline.rs:114-117). UI and 2D text systems treat it as transient — the entity is queued and reprocessed the following frame — so it is usually a wait-a-frame condition unless the font can never load.

Source

Thrown at crates/bevy_text/src/error.rs:8

use thiserror::Error;

#[derive(Debug, PartialEq, Eq, Error)]
/// Errors related to the textsystem
pub enum TextError {
    /// Font was not found, this could be that the font has not yet been loaded, or
    /// that the font failed to load for some other reason
    #[error("font not found")]
    NoSuchFont,
    /// Font was not found, this could be that the font has not yet been loaded, or
    /// that the font failed to load for some other reason
    #[error("No such font family {0:?}")]
    NoSuchFontFamily(String),
    /// Failed to add glyph to a newly created atlas for some reason
    #[error("failed to add glyph to newly-created atlas {0:?}")]
    FailedToAddGlyph(u16),
    /// Failed to get scaled glyph image for cache key
    #[error("failed to get scaled glyph image for cache key: {0:?}")]
    FailedToGetGlyphImage(u16),
    /// Missing texture atlas layout for the font
    #[error("missing texture atlas layout for the font")]
    MissingAtlasLayout,
    /// Missing texture for the font atlas
    #[error("missing texture for the font atlas")]
    MissingAtlasTexture,
    /// Failed to find glyph in atlas after it was added

View on GitHub (pinned to 396ca72708)

Solutions

  1. If it is purely async loading, do nothing — the reprocess queue renders the text next frame
  2. Verify the font path and extension under assets/ (case-sensitive on Linux; .ttf/.otf)
  3. Check the asset load error Bevy logs — a failed load makes this permanent
  4. Gate text spawning on asset_server.is_loaded_with_dependencies(&handle) when the first frame must be correct

Example fix

// before — text spawns while the font is still loading
let font = asset_server.load("fonts/GameFont.ttf");
commands.spawn(Text2d::new("hello").with_font(TextFont { font, ..default() }));

// after — spawn once the font (and its dependencies) are ready
let font = asset_server.load("fonts/GameFont.ttf");
if asset_server.is_loaded_with_dependencies(&font) {
    commands.spawn(Text2d::new("hello").with_font(TextFont { font, ..default() }));
}
Defensive patterns

Strategy: retry

Validate before calling

fn font_ready(server: &AssetServer, handle: &Handle<Font>) -> bool {
    server.is_loaded_with_dependencies(handle)
}

Type guard

fn font_loaded(server: &AssetServer, handle: &Handle<Font>) -> bool {
    server.is_loaded_with_dependencies(handle)
}

Try / catch

match text_pipeline.update_buffer(/* ... */) {
    Err(TextError::NoSuchFont) => { /* requeue entity, retry next frame */ }
    Err(e) => return Err(e),
    Ok(()) => {}
}

Prevention

When it happens

Trigger: Spawning Text2d/Text UI with a font handle obtained from asset_server.load() in the same frame; the font file missing from assets/, wrong path/case, or an unsupported/corrupted file so loading fails; using a weak/default handle for a font that is not loaded.

Common situations: Text appearing one frame late (benign); no text ever rendering because 'fonts/MyFont.ttf' does not exist or the extension/case is wrong on Linux; fonts in a directory not packaged into the assets folder; wasm builds missing font files.

Related errors


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/fb6b65efbe3e26b1. Report an issue: GitHub.