{"record":{"id":"2b8884b5890873df","repo":"bevyengine/bevy","slug":"field-name-should-exist","errorCode":null,"errorMessage":"Field name should exist","messagePattern":"Field name should exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_animation/src/animation_curves.rs","lineNumber":255,"sourceCode":"    }\n\n    fn evaluator_id(&self) -> EvaluatorId<'_> {\n        EvaluatorId::ComponentField(&self.evaluator_id)\n    }\n}\n\nimpl<C: Typed, P, F: Fn(&mut C) -> &mut P + 'static> AnimatedField<C, P, F> {\n    /// Creates a new instance of [`AnimatedField`]. This operates under the assumption that\n    /// `C` is a reflect-able struct, and that `field_name` is a valid field on that struct.\n    ///\n    /// # Panics\n    /// If the type of `C` is not a struct or if the `field_name` does not exist.\n    pub fn new_unchecked(field_name: &str, func: F) -> Self {\n        let field_index;\n        if let TypeInfo::Struct(struct_info) = C::type_info() {\n            field_index = struct_info\n                .index_of(field_name)\n                .expect(\"Field name should exist\");\n        } else if let TypeInfo::TupleStruct(struct_info) = C::type_info() {\n            field_index = field_name\n                .parse()\n                .expect(\"Field name should be a valid tuple index\");\n            if field_index >= struct_info.field_len() {\n                panic!(\"Field name should be a valid tuple index\");\n            }\n        } else {\n            panic!(\"Only structs are supported in `AnimatedField::new_unchecked`\")\n        }\n\n        Self {\n            func,\n            evaluator_id: Hashed::new((TypeId::of::<C>(), field_index)),\n            marker: PhantomData,\n        }\n    }\n}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_animation/src/animation_curves.rs#L237-L273","documentation":"ImageSaver (the AssetSaver for bevy Image assets) refuses to guess an output encoding when it cannot deduce one. With the default SaveImageFormatSetting::FromExtension, the saver looks at the destination AssetPath's extension to pick the file format; if the path has none, saving aborts before any bytes are written and the offending path is embedded in the error.","triggerScenarios":"Calling save_using_saver (or an asset-processing pipeline) with ImageSaver and ImageSaverSettings::default() while the destination path has no '.' segment, e.g. AssetPath::from_path(Path::new(\"images/player\")). At crates/bevy_image/src/saver.rs:38-39, asset_path.get_extension() returns None and MissingExtension is returned.","commonSituations":"Saving runtime-generated screenshots or procedural textures to computed paths (\"screenshot_3\", \"output/texture_v1\") and forgetting the .png suffix; renaming asset files without extensions; refactoring code that used to pass an explicit format.","solutions":["Append a supported extension such as .png to the destination asset path","Set an explicit format instead of relying on the path: ImageSaverSettings { format: SaveImageFormatSetting::Format(ImageFormat::Png) }","If paths are built at runtime, debug_assert!(path.extension().is_some()) before invoking the saver"],"exampleFix":"// before\nlet path = AssetPath::from_path(Path::new(\"screenshots/frame_42\"));\nsave_using_saver(server, &ImageSaver, path, saved, &ImageSaverSettings::default()).await?;\n\n// after\nlet path = AssetPath::from_path(Path::new(\"screenshots/frame_42.png\"));\nsave_using_saver(server, &ImageSaver, path, saved, &ImageSaverSettings::default()).await?;","handlingStrategy":"validation","validationCode":"use bevy_asset::AssetPath;\nuse std::path::Path;\n\nfn ensure_extension(path: &Path) -> Result<&Path, String> {\n    path.extension()\n        .map(|_| path)\n        .ok_or_else(|| format!(\"destination '{:?}' has no extension; use e.g. .png\", path))\n}","typeGuard":"fn has_extension(path: &AssetPath) -> bool {\n    path.get_extension().is_some()\n}","tryCatchPattern":"match save_using_saver(server, &ImageSaver, path, saved, &settings).await {\n    Err(SaveImageError::MissingExtension(p)) => warn!(\"skipping save, no extension: {p}\"),\n    other => other?,\n}","preventionTips":["Standardize on .png for all runtime-saved images","Build destination paths from a single helper that always appends the extension","Log the full AssetPath before saving in debug builds"],"tags":["rust","bevy","asset","image","file-extension","saver"],"backgroundTag":"missing-file-extension","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}