{"record":{"id":"52b46cd8df80e8c3","repo":"tracel-ai/burn","slug":"error-when-sending-response-through-callback-chann","errorCode":null,"errorMessage":"Error when sending response through callback channel: {err}","messagePattern":"Error when sending response through callback channel: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-train/src/checkpoint/async_checkpoint.rs","lineNumber":35,"sourceCode":"struct CheckpointerThread<C, R> {\n    checkpointer: C,\n    receiver: mpsc::Receiver<Message<R>>,\n}\n\nimpl<C, R> CheckpointerThread<C, R>\nwhere\n    C: Checkpointer<R>,\n    R: Checkpoint,\n{\n    fn run(self) {\n        for item in self.receiver.iter() {\n            match item {\n                Message::Restore(epoch, callback, interrupter) => {\n                    let record = self.checkpointer.restore(epoch);\n                    callback.send(record).unwrap_or_else(|err| {\n                        interrupter.map_or_else(\n                            || {\n                                panic!(\n                                    \"Error when sending response through callback channel: {err}\"\n                                )\n                            },\n                            |int| int.stop(Some(&err.to_string())),\n                        )\n                    });\n                }\n                Message::Save(epoch, state, interrupter) => {\n                    self.checkpointer.save(epoch, state).unwrap_or_else(|err| {\n                        interrupter.map_or_else(\n                            || panic!(\"Error when saving the state: {err}\"),\n                            |int| int.stop(Some(&err.to_string())),\n                        )\n                    });\n                }\n                Message::Delete(epoch, interrupter) => {\n                    self.checkpointer.delete(epoch).unwrap_or_else(|err| {\n                        interrupter.map_or_else(","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-train/src/checkpoint/async_checkpoint.rs#L17-L53","documentation":"Channel-failure escalation in the async checkpointer thread: after restoring a checkpoint, the worker sends the record back via a oneshot callback; if the receiver was dropped (training loop shut down or interrupted) the send fails and this panic fires — but only when no interrupter is available to stop the loop gracefully. It signals that the caller vanished before reading the restored checkpoint, not a checkpoint corruption.","triggerScenarios":"Thrown at crates/burn-train/src/checkpoint/async_checkpoint.rs:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the training loop keeps the callback receiver alive until the restore result is consumed.","Check for early exits/panics in the caller thread that drop the channel before receiving.","Provide the interrupter so shutdown paths stop the loop instead of panicking on a dead channel."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}