{"record":{"id":"0721af9ce0389165","repo":"tracel-ai/burn","slug":"failed-to-load-record","errorCode":null,"errorMessage":"Failed to load record","messagePattern":"Failed to load record","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-core/src/module/base.rs","lineNumber":482,"sourceCode":"        self,\n        record: crate::store::ModuleRecord,\n    ) -> Result<Self, crate::store::RecordError>\n    where\n        Self: Sized,\n    {\n        record.apply(self)\n    }\n\n    /// Apply a [`ModuleRecord`](crate::store::ModuleRecord) to this module, consuming and returning\n    /// it.\n    ///\n    /// Panics if validation fails; use [`try_load_record`](Module::try_load_record) for the\n    /// fallible variant.\n    fn load_record(self, record: crate::store::ModuleRecord) -> Self\n    where\n        Self: Sized,\n    {\n        self.try_load_record(record).expect(\"Failed to load record\")\n    }\n\n    /// Save this module's parameters to a burnpack file on disk.\n    ///\n    /// Convenience for [`into_record`](Module::into_record) followed by\n    /// [`ModuleRecord::save`](crate::store::ModuleRecord::save). For non-default load behavior\n    /// (dtype policy, partial loading, validation), go through the record directly.\n    #[cfg(feature = \"std\")]\n    fn save_file<P: AsRef<std::path::Path>>(self, path: P) -> Result<(), crate::store::RecordError>\n    where\n        Self: Sized,\n    {\n        self.into_record().save(path)\n    }\n\n    /// Load this module's parameters from a burnpack file on disk, returning the loaded module.\n    ///\n    /// Uses the default load behavior. Panics on I/O or validation errors; use","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-core/src/module/base.rs#L464-L500","documentation":"load_record is the infallible wrapper around try_load_record; it panics with 'Failed to load record' when the record does not match the module's structure (missing/extra fields, shape or dtype mismatches). The library panics because record validation failures are considered programming errors rather than runtime conditions.","triggerScenarios":"Calling module.load_record(record) where the record was saved from a module whose parameter shapes, dtypes, or field names differ from the target module.","commonSituations":"Loading checkpoints saved from an older model version after changing layer sizes; loading a checkpoint into a differently-configured model; record serialization format changes between burn versions.","solutions":["Switch to try_load_record and handle the Result to inspect the exact validation error.","Regenerate the record/checkpoint from the current module definition.","Ensure the module architecture (shapes, dtypes, names) matches the one that saved the record."],"exampleFix":"// before\nlet model = Model::load_record(record);\n// after\nlet model = Model::try_load_record(record)\n    .expect(\"checkpoint mismatch: regenerate the record for the current model\");","handlingStrategy":"validation","validationCode":"// Verify record compatibility before loading (fallible variant)\nlet model = match Model::try_load_record(record) {\n    Ok(m) => m,\n    Err(e) => panic!(\"record incompatible with model: {e}\"),\n};","typeGuard":null,"tryCatchPattern":"let model = Model::try_load_record(record)\n    .unwrap_or_else(|e| panic!(\"Failed to load record: {e}\"));","preventionTips":["Prefer try_load_record in application code","Keep checkpoints and model definitions versioned together","Assert shapes/dtypes after architecture changes before loading old checkpoints"],"tags":["rust","module","record","checkpoint","panic"],"backgroundTag":"record-shape-mismatch","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}