Skip to content

fix: propagate errors from backend installs#6236

Merged
jdx merged 18 commits intomainfrom
err-fix
Sep 9, 2025
Merged

fix: propagate errors from backend installs#6236
jdx merged 18 commits intomainfrom
err-fix

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Sep 8, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 8, 2025 13:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error propagation from backend installations by removing intermediate error wrapping layers and preserving the original error location for better debugging. The changes focus on making backend installation errors more traceable to their source.

  • Remove unnecessary error wrapping in toolset installation to preserve original error context
  • Add logic to propagate single installation failures directly rather than wrapping them
  • Move error wrapping to the backend layer with more detailed context information

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/toolset/mod.rs Removes WrapErr import, adds logic to propagate single installation failures directly, and removes error wrapping during install_version calls
src/backend/mod.rs Replaces WrapErr with Context import and adds detailed error wrapping at the backend layer with tool and version information

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

use backend_type::BackendType;
use console::style;
use eyre::{Result, WrapErr, bail, eyre};
use eyre::{Context, Result, bail, eyre};
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Context trait is imported but the code uses wrap_err method instead of context. Either use the context method or import WrapErr trait to match the usage pattern.

Suggested change
use eyre::{Context, Result, bail, eyre};
use eyre::{Context, Result, bail, eyre, WrapErr};

Copilot uses AI. Check for mistakes.
cursor[bot]

This comment was marked as outdated.

@jdx jdx marked this pull request as draft September 8, 2025 13:46
@github-actions
Copy link

github-actions bot commented Sep 8, 2025

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.9.6 x -- echo 18.9 ± 0.6 18.2 24.6 1.00
mise x -- echo 19.2 ± 0.2 18.8 20.5 1.01 ± 0.04

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.9.6 env 18.1 ± 0.3 17.5 19.7 1.00
mise env 18.7 ± 0.3 18.2 21.9 1.04 ± 0.02

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.9.6 hook-env 17.7 ± 0.2 17.3 18.8 1.00
mise hook-env 18.3 ± 0.2 17.8 19.4 1.03 ± 0.02

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.9.6 ls 16.1 ± 0.3 15.6 19.3 1.00
mise ls 16.3 ± 0.3 15.8 17.6 1.01 ± 0.02

xtasks/test/perf

Command mise-2025.9.6 mise Variance
install (cached) 165ms ✅ 102ms +61%
ls (cached) 61ms 62ms -1%
bin-paths (cached) 65ms 69ms -5%
task-ls (cached) 468ms 464ms +0%

✅ Performance improvement: install cached is 61%

- Remove special case that unwrapped single installation failures
- Update error formatting to show underlying error clearly for single failures
- Preserve error location information in all cases for better debugging
- Ensure consistent error handling regardless of failure count

This change improves error handling consistency by always returning
InstallFailed errors, with the display logic handling single vs
multiple failures appropriately.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jdx jdx marked this pull request as ready for review September 8, 2025 13:57
@jdx jdx enabled auto-merge (squash) September 8, 2025 14:00
jdx and others added 3 commits September 9, 2025 08:27
- Fixed import issue by using WrapErr trait instead of non-existent context method
- Added comprehensive error display tests for friendly and non-friendly error messages
- Updated parallel failure tests to match new error message format
- Fixed test_install_into by disabling GPG verification to avoid unrelated failures

The error handling now properly wraps errors with context at the backend layer
while preserving the original error details, making debugging easier while
maintaining clean error messages for users.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…nd info

- Changed error message to use full tool identifier instead of showing "via backend"
- Updated test expectations to match new error format
- The full tool name (e.g., "core:node") already contains backend information

This makes error messages cleaner and less redundant while still providing
all necessary debugging information.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
cursor[bot]

This comment was marked as outdated.

jdx and others added 7 commits September 9, 2025 08:45
- Removed MISE_NODE_VERIFY=0 from test_install_into (users can set MISE_GPG_VERIFY=0 locally if needed)
- Renamed test_error_display.sh to test_error_display (no .sh extension for e2e tests)
- Fixed error message format in errors.rs to use ba().full() instead of ba().short for complete tool identification
- Updated test patterns to check for exact tool names (e.g., "core:node") instead of using wildcards

This provides more accurate and consistent error messages that include the full
tool identifier with backend information.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed redundant error wrapping in backend/mod.rs to prevent duplicate "failed to install" messages
- Improved test_error_display to check full error output structure, not just single lines
- Tests now verify that error messages don't contain redundant wrapping
- Tests check error count to ensure no duplicate messages appear

The error handling now properly shows errors at the appropriate level without
redundant wrapping, making error messages clearer and more actionable.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…iline checks

- Replaced duplicate message counting with multiline string pattern matching
- Added normalize_output function to handle variable content (paths, versions, etc.)
- Tests now check the structure and format of error messages, not just fragments
- Each test verifies the complete error output structure similar to snapshot testing
- Fixed --file argument issue by using MISE_CONFIG_FILE environment variable

This makes the tests more robust and better at catching formatting regressions
while being less brittle about exact content that may vary between environments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…tion

- Removed normalize_output/strip_colors functions entirely
- Simply use NO_COLOR=1 environment variable to disable ANSI colors
- Tests now check raw error output without any transformations
- Cleaner and more maintainable test code

The test is now much simpler while still validating the complete error
message structure and format.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Tests now verify error structure across multiple lines, not just individual patterns
- Checks for proper error chain formatting with numbered entries (0:, 1:, etc.)
- Verifies Location: appears on its own line with file path on next line
- Ensures multiple tool failures list all failed tools
- Validates that simple errors remain concise
- Properly handles differences between debug and release build output

This makes the test behave more like a true snapshot test, validating
the complete multiline structure of error messages rather than just
checking for individual strings.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add NO_COLOR environment variable support throughout the codebase
- Integrate owo_colors::set_override for proper color control with color-eyre
- Update CLICOLOR logic to check NO_COLOR as fallback
- Fix error display test to use assert_fail with ANSI stripping
- Add comprehensive error message testing with larger substring checks
- Strip ANSI codes in test assertions to handle color output

This ensures NO_COLOR is properly respected in all error outputs and terminal display.
- Replace owo_colors::set_override approach with color-eyre's Theme system
- Use Theme::new() (blank theme) when CLICOLOR=false to disable colors
- Use default color-eyre::install() when colors are enabled
- Remove owo-colors dependency as color-eyre provides proper theme handling
- Revert changes to e2e/assert.sh as colors are now properly disabled at source

This provides proper NO_COLOR support through color-eyre's built-in theming system.
jdx and others added 5 commits September 9, 2025 10:09
- Revert assert.sh to original state to avoid forcing MISE_FRIENDLY_ERROR=1
- Create local_assert_fail function in test_error_display that respects env variables
- Update error message expectations to match actual detailed error format
- Ensure proper testing of both friendly and detailed error modes

This allows the test to properly verify both MISE_FRIENDLY_ERROR=1 and =0 behaviors
without the global assert_fail function interfering.
…alidation

- Update test_error_display to check larger portions of error messages
- Include full URLs, specific HTTP error codes, and complete error chains
- Test both friendly error format (MISE_FRIENDLY_ERROR=1) and detailed format (=0)
- Validate actual error content like:
  - Node.js 404 errors with full nodejs.org URLs
  - Cargo crate registry 404 errors with index.crates.io URLs
  - GitHub API 404 errors with api.github.com URLs
  - Multiple tool failure scenarios with aqua backend errors
  - Backtrace-enabled error format differences

This provides much more thorough validation that error messages contain
the expected detailed information for debugging.
…efault logic

- Change MISE_FRIENDLY_ERROR from Option<bool> to bool
- Move default behavior logic into the env variable definition itself
- Remove duplication of default logic in main.rs
- Default behavior: !cfg!(debug_assertions) && log::max_level() < log::LevelFilter::Debug

This eliminates the match statement in main.rs and centralizes the default
behavior logic in the environment variable definition.
Resolved conflicts:
- src/toolset/mod.rs: Combined DashMap import with existing eyre imports
- e2e/tasks/test_task_parallel_execution: Kept reliability comment
@jdx
Copy link
Owner Author

jdx commented Sep 9, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@jdx jdx merged commit 2b3b35e into main Sep 9, 2025
18 checks passed
@jdx jdx deleted the err-fix branch September 9, 2025 15:37
@jdx jdx mentioned this pull request Sep 9, 2025
jdx added a commit that referenced this pull request Sep 9, 2025
### 🐛 Bug Fixes

- **(env)** allow mixed map for env._.file by @risu729 in
[#6148](#6148)
- **(tasks)** restore parallel starts with poetry via list_paths cache
and stable exec-env cache by @jdx in
[#6237](#6237)
- add 'unknown' to the list of OS patterns by @efussi in
[#6235](#6235)
- propagate errors from backend installs by @jdx in
[#6236](#6236)

### 📦️ Dependency Updates

- update taiki-e/install-action digest to 0c5db7f by @renovate[bot] in
[#6244](#6244)
- update golang docker tag to v1.25.1 by @renovate[bot] in
[#6247](#6247)
- update dependency vitepress to v1.6.4 by @renovate[bot] in
[#6246](#6246)

### New Contributors

- @efussi made their first contribution in
[#6235](#6235)

Co-authored-by: mise-en-dev <release@mise.jdx.dev>
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 19, 2025
## [2025.9.12](https://github.com/jdx/mise/compare/v2025.9.11..v2025.9.12) - 2025-09-16

### 🐛 Bug Fixes

- **(ci)** properly exclude aqua-registry files from hk linting by @jdx in [42d7758](jdx/mise@42d7758)

### Chore

- **(release)** embed aqua-registry under crate and publish like vfox by @jdx in [#6306](jdx/mise#6306)
- ignore aqua-registry assets from prettier by @jdx in [047d77b](jdx/mise@047d77b)
- disable "useless cat" shellcheck by @jdx in [a6def59](jdx/mise@a6def59)

## [2025.9.11](https://github.com/jdx/mise/compare/v2025.9.10..v2025.9.11) - 2025-09-16

### 📦 Registry

- indicate aws-cli is v2 by @jayvdb in [#6300](jdx/mise#6300)

### 🚀 Features

- **(ci)** run all registry tools when workflow_dispatch is triggered by @jdx in [#6295](jdx/mise#6295)
- **(cli)** handle non-existent working directories gracefully by @jdx in [#6304](jdx/mise#6304)
- **(set)** add -E/--env flag to mise set command by @jdx in [#6291](jdx/mise#6291)
- **(tasks)** make auto outputs default by @risu729 in [#6137](jdx/mise#6137)

### 🐛 Bug Fixes

- align crate versions to fix release-plz script by @jdx in [5a464e9](jdx/mise@5a464e9)

### 🚜 Refactor

- **(aqua)** extract aqua registry into internal subcrate by @jdx in [#6293](jdx/mise#6293)

### 📚 Documentation

- fix mkdir paths by @risu729 in [#6298](jdx/mise#6298)
- fix rust profile default by @risu729 in [#6305](jdx/mise#6305)

### Chore

- **(aqua-registry)** remove unused aqua-registry files by @jdx in [#6294](jdx/mise#6294)
- **(release)** make release-plz idempotent for existing crate versions by @jdx in [dbdfd6a](jdx/mise@dbdfd6a)
- **(release)** skip publishing mise when aqua-registry is a path dep by @jdx in [47efffd](jdx/mise@47efffd)
- keep aqua-registry LICENSE file by @risu729 in [#6297](jdx/mise#6297)

### New Contributors

- @jayvdb made their first contribution in [#6300](jdx/mise#6300)

## [2025.9.10](https://github.com/jdx/mise/compare/v2025.9.9..v2025.9.10) - 2025-09-13

### 📦 Registry

- use asdf to install semver-tool by @jylenhof in [#6233](jdx/mise#6233)

### 🐛 Bug Fixes

- **(tool-stub)** detect binary names from single-file downloads by @jdx in [#6281](jdx/mise#6281)

### 🚜 Refactor

- allow any collection types in deserialize_arr by @risu729 in [#6282](jdx/mise#6282)
- use deserialize_arr for task runs by @risu729 in [#6253](jdx/mise#6253)

### 📚 Documentation

- **(getting-started)** add backends step with diagram, github example, env vars and simple tasks by @jdx in [#6288](jdx/mise#6288)
- simplify OS detection in tool plugin development by @jdx in [#6287](jdx/mise#6287)
- update backend plugin template references by @jdx in [942f5eb](jdx/mise@942f5eb)

### 📦️ Dependency Updates

- update rust crate chrono to v0.4.42 by @renovate[bot] in [#6274](jdx/mise#6274)
- update taiki-e/install-action digest to 0154864 by @renovate[bot] in [#6273](jdx/mise#6273)

### Chore

- **(schema)** fix schema for subtasks by @risu729 in [#6289](jdx/mise#6289)
- update render:schema task by @risu729 in [#6275](jdx/mise#6275)

## [2025.9.9](https://github.com/jdx/mise/compare/v2025.9.8..v2025.9.9) - 2025-09-11

### 🐛 Bug Fixes

- **(backend)** make HTTP installs atomic and serialize with cache lock by @jdx in [#6259](jdx/mise#6259)
- **(env)** allow nested env._.path directives by @risu729 in [#6160](jdx/mise#6160)
- **(env)** disallow nested env objects by @risu729 in [#6268](jdx/mise#6268)
- **(schema)** allow nested arrays in task.depends by @risu729 in [#6265](jdx/mise#6265)
- **(task)** resolve jobs=1 hang and keep-order panic; improve Ctrl-C handling by @jdx in [#6264](jdx/mise#6264)
- **(tasks)** stop CLI group after first failure without --continue-on-error by @jdx in [#6270](jdx/mise#6270)

### 📚 Documentation

- fixed toml issues in URL replacements settings documentation by @ThomasSteinbach in [#6269](jdx/mise#6269)

### Chore

- **(schema)** strict oneOf branches and DRY env_directive in schemas by @jdx in [#6271](jdx/mise#6271)
- add schema linter by @risu729 in [#6267](jdx/mise#6267)

## [2025.9.8](https://github.com/jdx/mise/compare/v2025.9.7..v2025.9.8) - 2025-09-10

### 🐛 Bug Fixes

- **(tasks)** prevent hang when task fails in sequence by @jdx in [#6260](jdx/mise#6260)
- **(version)** fetch mise version if cached version is older than the current by @risu729 in [#6252](jdx/mise#6252)

### 📦️ Dependency Updates

- update rhysd/action-setup-vim action to v1.4.3 by @renovate[bot] in [#6249](jdx/mise#6249)

## [2025.9.7](https://github.com/jdx/mise/compare/v2025.9.6..v2025.9.7) - 2025-09-09

### 🐛 Bug Fixes

- **(env)** allow mixed map for env._.file by @risu729 in [#6148](jdx/mise#6148)
- **(tasks)** restore parallel starts with poetry via list_paths cache and stable exec-env cache by @jdx in [#6237](jdx/mise#6237)
- add 'unknown' to the list of OS patterns by @efussi in [#6235](jdx/mise#6235)
- propagate errors from backend installs by @jdx in [#6236](jdx/mise#6236)

### 📦️ Dependency Updates

- update taiki-e/install-action digest to 0c5db7f by @renovate[bot] in [#6244](jdx/mise#6244)
- update golang docker tag to v1.25.1 by @renovate[bot] in [#6247](jdx/mise#6247)
- update dependency vitepress to v1.6.4 by @renovate[bot] in [#6246](jdx/mise#6246)

### New Contributors

- @efussi made their first contribution in [#6235](jdx/mise#6235)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants