Skip to content

fix(unikraft): preserve underlying error details on version parse failure - #951

Open
KHARSHAVARDHAN-eng wants to merge 1 commit into
urunc-dev:mainfrom
KHARSHAVARDHAN-eng:fix/issue-891-unikraft-version-error-detail
Open

fix(unikraft): preserve underlying error details on version parse failure#951
KHARSHAVARDHAN-eng wants to merge 1 commit into
urunc-dev:mainfrom
KHARSHAVARDHAN-eng:fix/issue-891-unikraft-version-error-detail

Conversation

@KHARSHAVARDHAN-eng

Copy link
Copy Markdown

Fixes #891

Summary

In pkg/unikontainers/unikernels/unikraft.go, when u.Version failed to parse, configureUnikraftArgs() previously discarded the underlying error and returned only a generic ErrVersionParsing. This masked the exact root cause (such as malformed strings or invalid characters).

Solution

  • Updated configureUnikraftArgs() to wrap the original parsing error: fmt.Errorf("%w: %w", ErrVersionParsing, err).
  • Preserves errors.Is(err, ErrVersionParsing) compatibility while surfacing the underlying parse error message to the caller.
  • Added comprehensive unit tests in unikraft_test.go covering empty, invalid, legacy, and current version strings.

…lure

When u.Version failed to parse, configureUnikraftArgs() previously discarded
the underlying error and returned only generic ErrVersionParsing.

Wrap the original parsing error with ErrVersionParsing (fmt.Errorf("%w: %w", ...))
to expose the root cause details while maintaining errors.Is compatibility with
ErrVersionParsing.

Fixes urunc-dev#891

Signed-off-by: Harsha Vardhan <harshahvk2005@gmail.com>
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit f8f4a74
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a7ace8a7c5ef40008a5f765

@cmainas cmainas added invalid This doesn't seem right do-not-merge labels Aug 11, 2026
@Nachiket-Roy

Copy link
Copy Markdown

Hello @KHARSHAVARDHAN-eng, the changes are correct. However, I don't see the need of adding tests in this PR, test coverage will be handled separately ig.

Side note - make sure to not overwrite the PR template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version parsing failure in unikraft.go discards underlying error detail

3 participants