bevyengine/bevy · error · RegisteredSystemError

Cached system was not found

Error message

Cached system was not found

What it means

RegisteredSystemError::SystemNotCached: remove_system_cached was called to remove a cached system by value, but no cached system of that type was found in the registry.

Source

Thrown at crates/bevy_ecs/src/system/system_registry.rs:850

        S: IntoSystem<I, O, M> + 'static,
    {
        let id = self.register_system_cached(system);
        self.run_system_with(id, input)
    }
}

/// An operation with stored systems failed.
#[derive(Error)]
pub enum RegisteredSystemError<I: SystemInput = (), O = ()> {
    /// A system was run by id, but no system with that id was found.
    ///
    /// Did you forget to register it?
    #[error("System {0:?} was not registered")]
    SystemIdNotRegistered(SystemId<I, O>),
    /// A cached system was removed by value, but no system with its type was found.
    ///
    /// Did you forget to register it?
    #[error("Cached system was not found")]
    SystemNotCached,
    /// The `RegisteredSystem` component is missing.
    #[error("System {0:?} does not have a RegisteredSystem component. This only happens if app code removed the component.")]
    MissingRegisteredSystemComponent(SystemId<I, O>),
    /// A system tried to remove itself.
    #[error("System {0:?} tried to remove itself")]
    SelfRemove(SystemId<I, O>),
    /// System could not be run due to parameters that failed validation.
    /// This is not considered an error.
    #[error("System did not run due to failed parameter validation: {0}")]
    Skipped(SystemParamValidationError),
    /// System returned an error or failed required parameter validation.
    #[error("System returned error: {0}")]
    Failed(BevyError),
    /// [`SystemId`] had different input and/or output types than [`SystemIdMarker`]
    #[error("Could not get system from `{}`, entity was `SystemId<{}, {}>`", DebugName::type_name::<SystemId<I, O>>(), .1.input_type_id.name, .1.output_type_id.name)]
    IncorrectType(SystemId<I, O>, SystemIdMarker),
    /// System is not present in the `RegisteredSystem` component.

View on GitHub (pinned to 396ca72708)

Solutions

  1. Ensure the system was registered via register_system_cached before calling remove_system_cached
  2. Pass the exact same system value/type that was cached
  3. Match on the error variant and treat removal of a non-cached system as a no-op
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/bevy_ecs/src/system/system_registry.rs:850 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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