openai/codex · error · anyhow::Error

animation fps must be finite and between 0 and , got

Error message

animation {name} fps must be finite and between 0 and {MAX_ANIMATION_FPS}, got {fps}

What it means

Validation guard in load_animations: a custom animation spec provided an fps that is non-finite (NaN/infinity), zero, or exceeds MAX_ANIMATION_FPS, which would break timing or cause division/rendering pathologies in the pet animation loop.

Solutions

  1. Set the animation's fps to a positive finite value at or below MAX_ANIMATION_FPS
  2. Omit fps from the spec to use the manifest/default rate
  3. Clamp or reject the value upstream before parsing into AnimationSpec
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/tui/src/pets/model.rs:413 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/4681da336fb0877b. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/tui/src/pets/model.rs:413

        return Ok(animations);
    }

    for (name, spec) in specs {
        if spec.frames.is_empty() {
            bail!("animation {name} must include at least one frame");
        }
        for sprite_index in &spec.frames {
            if *sprite_index >= frame_count {
                bail!(
                    "animation {name} references sprite index {sprite_index}, but pet has {frame_count} frames"
                );
            }
        }

        let fps = match spec.fps {
            Some(fps) if fps.is_finite() && fps > 0.0 && fps <= MAX_ANIMATION_FPS => fps,
            Some(fps) => {
                bail!(
                    "animation {name} fps must be finite and between 0 and {MAX_ANIMATION_FPS}, got {fps}"
                );
            }
            None => 8.0,
        };
        let duration = Duration::from_secs_f64(1.0 / fps);
        let fallback = if spec.fallback.is_empty() {
            "idle".to_string()
        } else {
            spec.fallback
        };
        let loop_start = spec
            .loop_animation
            .unwrap_or(/*default*/ true)
            .then_some(/*loop_start*/ 0);

        animations.insert(
            name,

View on GitHub (pinned to 339751715c)