bevyengine/bevy · error · ArgError
expected `{expected}` but received `{received}` (@ argument
Error message
expected `{expected}` but received `{received}` (@ argument index {index}) What it means
ArgError::UnexpectedType — while converting a reflected argument for a dynamic function call, the argument's type did not match the parameter's expected type. The payload carries the argument index plus the expected and received type paths.
Source
Thrown at crates/bevy_reflect/src/func/args/error.rs:13
use alloc::borrow::Cow;
use thiserror::Error;
use crate::func::args::Ownership;
/// An error that occurs when converting an [argument].
///
/// [argument]: crate::func::args::Arg
#[derive(Debug, Error, PartialEq)]
pub enum ArgError {
/// The argument is not the expected type.
#[error("expected `{expected}` but received `{received}` (@ argument index {index})")]
UnexpectedType {
/// Argument index.
index: usize,
/// Expected argument type path.
expected: Cow<'static, str>,
/// Received argument type path.
received: Cow<'static, str>,
},
/// The argument has the wrong ownership.
#[error("expected {expected} value but received {received} value (@ argument index {index})")]
InvalidOwnership {
/// Argument index.
index: usize,
/// Expected ownership.
expected: Ownership,
/// Received ownership.
received: Ownership,
},View on GitHub (pinned to 396ca72708)
Solutions
- Pass an argument of the expected type at the failing index
- Fix the function's argument signature to match what callers send
- Convert the argument before calling
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/bevy_reflect/src/func/args/error.rs:13 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/b13fe675ee305c22.
Report an issue: GitHub.