kmesh-net/kmesh

Improper Error Wrapping (%w)

Open

#1,608 opened on Mar 7, 2026

View on GitHub
 (3 comments) (0 reactions) (1 assignee)Go (239 forks)auto 404
good first issue

Repository metrics

Stars
 (739 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently, when Kmesh encounters an error and passes it up to another part of the program, it often converts that error into a simple text message.

While this looks fine in the logs, it creates a problem for the code itself: it "destroys" the original error's identity. If one part of Kmesh needs to know exactly what went wrong (for example, distinguishing between a "Network Timeout" and an "Invalid Secret"), it can no longer do that because the error has been turned into a generic string of text.

By using "Error Wrapping" instead, we allow the program to look inside an error message to see the original cause. This enables "smarter" error handling, where the system can automatically retry certain types of failures while stopping for others.

Solution: We need to update the way errors are formatted across the project. Instead of just printing the error's text, we should "wrap" the original error so that its type and data remain accessible to other parts of the system.

Contributor guide