bevyengine/bevy · error · FunctionOverloadError

could not add function overload: duplicate found for signatu

Error message

could not add function overload: duplicate found for signature `{0:?}`

What it means

FunctionOverloadError::DuplicateOverload — an overload with the given argument signature (payload) already exists on the function, so adding it again is rejected. Remove the duplicate registration or use a distinct signature.

Source

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

/// The result of calling a [`DynamicFunction`] or [`DynamicFunctionMut`].
///
/// Returns `Ok(value)` if the function was called successfully,
/// where `value` is the [`Return`] value of the function.
///
/// [`DynamicFunction`]: crate::func::DynamicFunction
/// [`DynamicFunctionMut`]: crate::func::DynamicFunctionMut
pub type FunctionResult<'a> = Result<Return<'a>, FunctionError>;

/// An error that occurs when attempting to add a function overload.
#[derive(Debug, Error, PartialEq)]
pub enum FunctionOverloadError {
    /// A [`SignatureInfo`] was expected, but none was found.
    ///
    /// [`SignatureInfo`]: crate::func::info::SignatureInfo
    #[error("expected at least one `SignatureInfo` but found none")]
    MissingSignature,
    /// An error that occurs when attempting to add a function overload with a duplicate signature.
    #[error("could not add function overload: duplicate found for signature `{0:?}`")]
    DuplicateSignature(ArgumentSignature),
    /// An attempt was made to add an overload with more than [`ArgCount::MAX_COUNT`] arguments.
    ///
    /// [`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.

View on GitHub (pinned to 396ca72708)

Solutions

  1. Change one overload's argument types so signatures differ
  2. Remove the duplicate overload before adding a new one
Defensive patterns

Strategy: validation

When it happens

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