jdx/mise · error
{} package hook returned invalid state '{}' for '{}'
Error message
{} package hook returned invalid state '{}' for '{}' What it means
The plugin's check/status hook reports each package's state as a string (installed, missing, etc.). When the hook returns a state string the library doesn't recognize, installed() rejects it explicitly instead of guessing, since an unknown state would corrupt install/prune decisions.
Source
Thrown at src/system/packages/plugin.rs:563
.packages
.into_iter()
.map(|pkg| (pkg.name.clone(), pkg))
.collect();
pkgs.iter()
.map(|request| {
let returned = by_name.get(&request.name);
let state = match returned {
Some(pkg) if pkg.state == "installed" => {
let installed = pkg.version.clone().unwrap_or_default();
match &request.version {
Some(requested) if requested != &installed => {
PackageState::VersionMismatch { installed }
}
_ => PackageState::Installed { version: installed },
}
}
Some(pkg) if pkg.state == "missing" => PackageState::Missing,
Some(pkg) => bail!(
"{} package hook returned invalid state '{}' for '{}'",
self.name,
pkg.state,
request.name
),
None => bail!(
"{} package hook did not return state for '{}'",
self.name,
request.name
),
};
Ok(PackageStatus {
request: request.clone(),
state,
})
})
.collect()
}View on GitHub (pinned to afd2eddd3a)
Solutions
- Update mise to a version that recognizes the state string the plugin emits (plugin and mise version mismatch)
- Fix or roll back the plugin's package hook so it returns only supported states (e.g. 'installed', 'missing', supported variants)
- Inspect the plugin's hooks/package_check.lua (or equivalent) for typos in state strings
- Report the incompatible plugin to its maintainer if it targets a newer mise schema
Example fix
// before (plugin hook Lua)
return { state = "partially-installed", version = v }
// after
return { state = "installed", version = v } Defensive patterns
Strategy: type-guard
Validate before calling
const KNOWN_STATES: [&str; 2] = ["installed", "missing"];
if !KNOWN_STATES.contains(&pkg.state.as_str()) { /* reject/fix plugin hook */ } Type guard
fn is_valid_state(pkg: &HookPkg) -> bool {
matches!(pkg.state.as_str(), "installed" | "missing")
} Try / catch
match plugin.installed(&req).await {
Err(e) if e.to_string().contains("returned invalid state") => {
log_plugin_bug(&e); treat_as_unknown_and_skip()
}
other => other,
} Prevention
- Keep plugin and mise versions in sync; update both together
- Only return documented state strings from custom plugin hooks
- Test plugin hooks directly with the manager CLI before wiring them into mise
When it happens
Trigger: The plugin's package hook (invoked via installed) returns a pkg.state value outside the recognized set (e.g. a typo like 'instaled', a new state string from a newer plugin, or plugin Lua returning an unexpected marker).
Common situations: Plugin updated to emit a new state string not yet supported by this mise version; custom/local plugin whose status hook returns ad-hoc state names; Lua hook bug producing a malformed state.
Related errors
- {} package hook did not return state for '{}'
- brew-cask: unresolved recovery for {} still preserves its or
- brew-cask: unresolved recovery for newly created target {}
- pre_use hook is not implemented
- {tool}'s bin/install exited successfully but installed nothi
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/d339c82531139bb7.
Report an issue: GitHub.