bevyengine/bevy · error · FunctionError
received {received} arguments but expected one of {expected:
Error message
received {received} arguments but expected one of {expected:?} What it means
FunctionError::ArgCountMismatch — a dynamic function/mut function was called with a number of arguments matching none of its registered overload signatures. Payloads: the received count and the set of expected counts.
Source
Thrown at crates/bevy_reflect/src/func/error.rs:20
use crate::func::{
args::{ArgCount, ArgError},
Return,
};
use alloc::borrow::Cow;
use bevy_platform::collections::HashSet;
use thiserror::Error;
/// An error that occurs when calling a [`DynamicFunction`] or [`DynamicFunctionMut`].
///
/// [`DynamicFunction`]: crate::func::DynamicFunction
/// [`DynamicFunctionMut`]: crate::func::DynamicFunctionMut
#[derive(Debug, Error, PartialEq)]
pub enum FunctionError {
/// An error occurred while converting an argument.
#[error(transparent)]
ArgError(#[from] ArgError),
/// The number of arguments provided does not match the expected number.
#[error("received {received} arguments but expected one of {expected:?}")]
ArgCountMismatch {
/// Expected argument count. [`ArgCount`] for overloaded functions will contain multiple possible counts.
expected: ArgCount,
/// Number of arguments received.
received: usize,
},
/// No overload was found for the given set of arguments.
#[error("no overload found for arguments with signature `{received:?}`, expected one of `{expected:?}`")]
NoOverload {
/// The set of available argument signatures.
expected: HashSet<ArgumentSignature>,
/// The received argument signature.
received: ArgumentSignature,
},
}
/// The result of calling a [`DynamicFunction`] or [`DynamicFunctionMut`].
///View on GitHub (pinned to 396ca72708)
Solutions
- Pass exactly the arguments the function expects
- Inspect the function's signature info before calling
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_reflect/src/func/error.rs:20 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/92d6a7feb0c04fc7.
Report an issue: GitHub.