{"record":{"id":"999ff4f164fd222c","repo":"FyroxEngine/Fyrox","slug":"malformed-options-file-fallback-to-defaults","errorCode":null,"errorMessage":"Malformed options file {:?}, fallback to defaults! Reason: {}","messagePattern":"Malformed options file (.+?), fallback to defaults! Reason: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"fyrox-resource/src/options.rs","lineNumber":85,"sourceCode":"{\n    fn save(&self, path: &Path) -> bool {\n        self.save_internal(path)\n    }\n}\n\n/// Tries to load import settings for a resource. It is not part of ImportOptions trait because\n/// `async fn` is not yet supported for traits.\npub async fn try_get_import_settings<T>(resource_path: &Path, io: &dyn ResourceIo) -> Option<T>\nwhere\n    T: ImportOptions,\n{\n    let settings_path = append_extension(resource_path, OPTIONS_EXTENSION);\n\n    match io.load_file(settings_path.as_ref()).await {\n        Ok(bytes) => match ron::de::from_bytes::<T>(&bytes) {\n            Ok(options) => Some(options),\n            Err(e) => {\n                Log::warn(format!(\n                    \"Malformed options file {:?}, fallback to defaults! Reason: {}\",\n                    settings_path, e\n                ));\n\n                None\n            }\n        },\n        Err(e) => {\n            // Missing options file is a normal situation, the engine will use default import options\n            // instead. Any other error indicates a real issue that needs to be highlighted to the\n            // user.\n            if let FileError::Io(ref err) = e {\n                if err.kind() == ErrorKind::NotFound {\n                    return None;\n                }\n            }\n\n            Log::warn(format!(","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-resource/src/options.rs#L67-L103","documentation":"ResourceImporter reads per-resource import options from a companion .options file (RON-serialized). If the file exists but fails to deserialize as the expected options type T, this warning is logged and the importer falls back to default import options. The resource still imports, just not with the intended custom settings.","triggerScenarios":"Loading a resource whose sibling options file (path + OPTIONS_EXTENSION) exists but contains invalid RON, wrong fields, or options for a mismatched options type — ron::de::from_bytes::<T> returns Err.","commonSituations":"Hand-editing .options files and introducing RON syntax errors; engine upgrade changing the options struct so old fields no longer parse; copying .options files between different resource types.","solutions":["Fix or delete the malformed .options file; a fresh one with defaults will be written on next import.","Validate the RON syntax against the current options struct (check field names/types after upgrades).","Re-import the resource in the editor so a correct options file is regenerated, then reapply custom settings."],"exampleFix":"// malformed texture.options\n( compression: \"yes please\" )\n// after — valid RON matching TextureImportOptions\n(\n    compression: true,\n)\n","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Edit .options files only through the Fyrox editor import dialog.","After engine upgrades, re-import resources so options structs match the current RON schema.","Validate hand-written RON with a linter/parser before committing options files."],"tags":["fyrox","assets","options","ron","serialization"],"backgroundTag":"invalid-config-value","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}