{"record":{"id":"bef130a75ca10e02","repo":"bevyengine/bevy","slug":"expected-owned-value","errorCode":null,"errorMessage":"expected owned value","messagePattern":"expected owned value","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/src/func/return_type.rs","lineNumber":42,"sourceCode":"    }\n\n    /// Returns `true` if the return value is an [`Owned`](Self::Owned) unit (`()`) type.\n    pub fn is_unit(&self) -> bool {\n        match self {\n            Return::Owned(val) => val.represents::<()>(),\n            _ => false,\n        }\n    }\n\n    /// Unwraps the return value as an owned value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the return value is not [`Self::Owned`].\n    pub fn unwrap_owned(self) -> Box<dyn PartialReflect> {\n        match self {\n            Return::Owned(value) => value,\n            _ => panic!(\"expected owned value\"),\n        }\n    }\n\n    /// Unwraps the return value as a reference to a value.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the return value is not [`Self::Ref`].\n    pub fn unwrap_ref(self) -> &'a dyn PartialReflect {\n        match self {\n            Return::Ref(value) => value,\n            _ => panic!(\"expected reference value\"),\n        }\n    }\n\n    /// Unwraps the return value as a mutable reference to a value.\n    ///\n    /// # Panics","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/src/func/return_type.rs#L24-L60","documentation":"Panic in Return::unwrap_owned: the Return holds a Ref or Mut rather than an Owned value, so unwrap_owned cannot take ownership. Match on the Return variant or use unwrap_ref/unwrap_mut as appropriate.","triggerScenarios":"Thrown at crates/bevy_reflect/src/func/return_type.rs:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check Return::is_owned() before unwrapping","Use unwrap_ref/unwrap_mut as appropriate for the actual variant"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}