bevyengine/bevy · error · FunctionRegistrationError

a function has already been registered with name {0:?}

Error message

a function has already been registered with name {0:?}

What it means

FunctionRegistrationError::DuplicateName — FunctionRegistry::register found that a function with the same name (payload) was already registered. Rename the function or overwrite/remove the existing registration.

Source

Thrown at crates/bevy_reflect/src/func/error.rs:76

    ///
    /// [`ArgCount::MAX_COUNT`]: crate::func::args::ArgCount
    #[error(
        "argument signature `{:?}` has too many arguments (max {})",
        0,
        ArgCount::MAX_COUNT
    )]
    TooManyArguments(ArgumentSignature),
}

/// An error that occurs when registering a function into a [`FunctionRegistry`].
///
/// [`FunctionRegistry`]: crate::func::FunctionRegistry
#[derive(Debug, Error, PartialEq)]
pub enum FunctionRegistrationError {
    /// A function with the given name has already been registered.
    ///
    /// Contains the duplicate function name.
    #[error("a function has already been registered with name {0:?}")]
    DuplicateName(Cow<'static, str>),
    /// The function is missing a name by which it can be registered.
    #[error("function name is missing")]
    MissingName,
}

View on GitHub (pinned to 396ca72708)

Solutions

  1. Choose a unique function name
  2. Remove or replace the previously registered function first
  3. Namespaced names (e.g. my_mod::func) help avoid collisions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_reflect/src/func/error.rs:76 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/b156b8a4a50d85a0. Report an issue: GitHub.