fix(error): prevent cleanup error from masking original error#214
Merged
DorianZheng merged 1 commit intomainfrom Feb 6, 2026
Merged
fix(error): prevent cleanup error from masking original error#214DorianZheng merged 1 commit intomainfrom
DorianZheng merged 1 commit intomainfrom
Conversation
When box initialization fails (e.g., image pull failure), the cleanup
guard removes the box from DB. If stop() is then called (e.g., from a
finally block), it would try to save to a non-existent box, returning
NotFound which masked the original error.
Changes:
- box_impl.rs: Handle NotFound gracefully in stop() - if box was already
removed by cleanup, return Ok(()) instead of propagating the error
- Remove redundant "Box not found:" prefix from NotFound error messages
since #[error("box not found: {0}")] already adds this prefix
Before: "box not found: Box not found: abc123"
After: "box not found: abc123"
And most importantly, users now see the actual error:
"storage error: Failed to pull image 'xxx' after trying 1 registry"
instead of the misleading "box not found" error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
When using a non-existent image, users saw:
Instead of the actual error:
Root cause: When
start()fails during image pull,CleanupGuard::drop()removes the box from DB. Thenstop()in the finally block tries to save to a deleted box, and thatNotFounderror overwrites the original error.Changes
box_impl.rsNotFoundinstop()gracefully - if box already removed, returnOk(())boxes.rs,rt_impl.rs,manager.rs,ffi.rsTest plan
cargo checkpasses