jdx/mise · error
brew-cask: command wrapper
Error message
brew-cask: command wrapper '{}' was not staged What it means
This error is thrown by `link_command_wrapper` when linking a brew-cask command wrapper artifact: the wrapper file that should have been staged inside the caskroom (`wrapper.caskroom_path(caskroom)`) does not exist as a file at link time. The staging and linking steps are separated, so this invariant failure means the staged artifact went missing or was never produced before linking.
Solutions
- Re-run the cask install so staging and linking happen together: `mise use` / re-install the affected cask.
- Clear the cask's partial state (remove its caskroom directory) and reinstall from scratch.
- Check for concurrent mise/homebrew processes that could clean the caskroom mid-install and run installs serially.
- If it persists, verify the cask's command-wrapper definition and check for a recent mise version change to wrapper staging paths; report if the mismatch is internal.
Example fix
// before (stale/partial caskroom state) rm -rf "$(brew --prefix)/Caskroom/mytool" mise install # restage and relink // after: staging and link run in one pass, wrapper found # install completes without 'command wrapper ... was not staged'
Defensive patterns
Strategy: try-catch
Validate before calling
let staged = wrapper.caskroom_path(&caskroom);
if !staged.is_file() {
eprintln!("wrapper not staged: {}", staged.display());
} Type guard
fn is_staged(wrapper: &CommandWrapperArtifact, caskroom: &Path) -> bool {
wrapper.caskroom_path(caskroom).is_file()
} Try / catch
match link_command_wrapper(&caskroom, &wrapper) {
Err(e) if e.to_string().contains("was not staged") => {
// restage: reinstall the cask, then retry the link
}
other => other?,
} Prevention
- Always run staging and linking as one install pass; never link manually from a stale caskroom.
- Avoid concurrent mise/homebrew operations touching the same caskroom.
- After a failed install, clear the cask's caskroom directory before retrying.
When it happens
Trigger: Calling the cask install/link pipeline where `CommandWrapperArtifact::caskroom_path(caskroom)` returns a path that is not an existing file — i.e., the wrapper was never staged, was deleted between staging and linking, or the caskroom path was computed differently in the two phases.
Common situations: A partially-failed prior install left the caskroom without the staged wrapper; a concurrent process cleaned the caskroom; a cask definition names a command wrapper that the staging step skipped; or a mise version change altered wrapper naming so the link step looks for the old staged filename.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- brew-cask: completion artifact
- brew-cask: refusing elevated operation because target…
- brew-cask: temporary artifact directory is not private
- brew-cask: temporary artifact directory was replaced
- brew-cask: unsupported generic artifact type
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/55678d913e2a8c99.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/brew/cask/mod.rs:3725
);
}
bail!(
"brew-cask: binary artifact '{}' was not staged",
binary.source
);
}
let target = binary.target_path(appdir)?;
if let Some(parent) = target.parent() {
create_dir_all_elevating(parent)?;
}
make_symlink_elevating(&caskroom_binary, &target)?;
Ok(())
}
fn link_command_wrapper(caskroom: &Path, wrapper: &CommandWrapperArtifact) -> Result<()> {
let source = wrapper.caskroom_path(caskroom);
if !source.is_file() {
bail!(
"brew-cask: command wrapper '{}' was not staged",
wrapper.name
);
}
let target = wrapper.target_path()?;
if let Some(parent) = target.parent() {
create_dir_all_elevating(parent)?;
}
make_symlink_elevating(&source, &target)?;
Ok(())
}
fn caskroom_binary_path(
caskroom: &Path,
appdir: &Path,
binary: &BinaryArtifact,
) -> Result<PathBuf> {
let target = binary.target_path(appdir)?;View on GitHub (pinned to 533346cc37)