{"record":{"id":"d057eb1050994196","repo":"bevyengine/bevy","slug":"field-name-should-be-a-valid-tuple-index","errorCode":null,"errorMessage":"Field name should be a valid tuple index","messagePattern":"Field name should be a valid tuple index","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_animation/src/animation_curves.rs","lineNumber":259,"sourceCode":"    }\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}\n\n/// This trait collects the additional requirements on top of [`Curve<T>`] needed for a\n/// curve to be used as an [`AnimationCurve`].\npub trait AnimationCompatibleCurve<T>: Curve<T> + Debug + Clone + Reflectable {}","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_animation/src/animation_curves.rs#L241-L277","documentation":"ImageSaver with the default FromExtension setting resolved an extension from the destination path, but bevy's ImageFormat::from_extension does not recognize it (crates/bevy_image/src/saver.rs:40-41). The unrecognized extension string is carried in the error. Saving stops because there is no format to encode with.","triggerScenarios":"Saving to a path whose extension is not in bevy's ImageFormat extension table, e.g. \"icon.bmp\", \"art.svg\", \"tex.pic\" — ImageFormat::from_extension(extension) returns None and UnknownExtension(extension) is returned.","commonSituations":"Using image formats that bevy can load but not name from extension, or non-image extensions (\".tmp\", \".dat\", \".svg\"); generating files with custom suffixes; case-mangled or compound suffixes like \"tex.v2\".","solutions":["Rename the destination to an extension bevy recognizes, such as .png (also .jpg/.jpeg/.gif/.tga/.tiff/.webp etc. for ImageFormat)","Pass the format explicitly if the format is supported but its extension is unusual: ImageSaverSettings { format: SaveImageFormatSetting::Format(ImageFormat::Png) }","Check ImageFormat::from_extension at build time for every path you generate"],"exampleFix":"// before\nlet path = AssetPath::from_path(Path::new(\"icon.bmp\"));\n\n// after\nlet path = AssetPath::from_path(Path::new(\"icon.png\"));\n// or keep the name but pin the format:\nlet settings = ImageSaverSettings {\n    format: SaveImageFormatSetting::Format(ImageFormat::Png),\n};","handlingStrategy":"validation","validationCode":"use bevy_image::ImageFormat;\n\nfn supported_extension(ext: &str) -> bool {\n    ImageFormat::from_extension(ext.to_ascii_lowercase()).is_some()\n}","typeGuard":"fn is_saveable_extension(ext: &str) -> bool {\n    // only PNG is actually writable today\n    matches!(ext.to_ascii_lowercase().as_str(), \"png\")\n}","tryCatchPattern":"match result {\n    Err(SaveImageError::UnknownExtension(ext)) => warn!(\"unknown extension '{ext}', rename to .png\"),\n    other => other?,\n}","preventionTips":["Whitelist save extensions (.png) at the point where paths enter your app","Lowercase extensions before checking (from_extension matches lowercase)","Note that a recognized extension is necessary but only .png is sufficient for saving"],"tags":["rust","bevy","asset","image","file-extension","saver"],"backgroundTag":"unsupported-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"}