bevyengine/bevy · error · ArgError
expected {expected} value but received {received} value (@ a
Error message
expected {expected} value but received {received} value (@ argument index {index}) What it means
ArgError::InvalidOwnership — the argument was provided with the wrong ownership (Owned/Ref/Mut) for the parameter, e.g. passing a shared ref where an owned value is consumed. Payloads: argument index, expected and received Ownership.
Source
Thrown at crates/bevy_reflect/src/func/args/error.rs:23
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,
},
/// Occurs when attempting to access an argument from an empty [`ArgList`].
///
/// [`ArgList`]: crate::func::args::ArgList
#[error("expected an argument but received none")]
EmptyArgList,
}
/// The given argument count is out of bounds.
#[derive(Debug, Error, PartialEq)]
#[error("argument count out of bounds: {0}")]View on GitHub (pinned to 396ca72708)
Solutions
- Pass the value with the ownership the signature expects (owned vs reference vs mutable reference)
- Adjust the function signature to accept the provided ownership
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_reflect/src/func/args/error.rs:23 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/d152680036df95a2.
Report an issue: GitHub.