jdx/mise · error
Cycle detected in tool overrides
Error message
Cycle detected in tool overrides
What it means
`sort_by_overrides` builds a dependency graph among tool override requests and topologically sorts them. If the number of sorted nodes is less than the graph's node count, a cycle exists in the tool override relationships, which makes a deterministic order impossible, so it bails.
Solutions
- Inspect your tool overrides in mise.toml for mutually-referencing entries and break the cycle.
- Simplify override configuration — usually only one tool needs the override.
- Reduce the config to one tool at a time to find which pair cycles.
- Check for override cycles introduced by a recently added config file in the hierarchy.
Example fix
// before
[tools]
node = { version = "20", overrides = { python = "3.12" } }
python = { version = "3.12", overrides = { node = "20" } }
// after
[tools]
node = "20"
python = "3.12" Defensive patterns
Strategy: validation
Validate before calling
// ensure each tool is overridden at most once
let mut seen = std::collections::HashSet::new();
for req in overrides { if !seen.insert(req.target()) { panic!("duplicate override target: {}", req.target()); } } Prevention
- Configure at most one override per tool dependency.
- Keep override chains one level deep where possible.
- Audit added [tools]/overrides entries when this error appears — a cycle was just introduced.
When it happens
Trigger: Calling toolset construction/sorting where override dependencies form a cycle — e.g. tool A's overrides point at tool B and B's at A (directly or transitively).
Common situations: Mistaken override chains in config (mise.toml `[tools]`/overrides referencing each other), or tool definitions whose dependency edges loop after a config merge.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- task input group cycle
- a provided source resolves to a path
- additional asset ' ' is not an archive
- agent ' ' `start_calendar_interval. ` must be between and
- agent ' ' `start_calendar_interval` must set at least one…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/5b74dddf4eb3ab73.
Report an issue: GitHub.
Appendix: source
Thrown at src/toolset/mod.rs:681
let mut sorted_ids: Vec<&str> = Vec::with_capacity(graph.node_count());
while let Some(Reverse((_, _, id))) = pq.pop() {
sorted_ids.push(id);
for neighbor in graph.neighbors(id) {
if let Some(deg) = in_degree.get_mut(neighbor) {
*deg -= 1;
if *deg == 0 {
let p = priorities[neighbor];
let idx = original_index[neighbor];
pq.push(Reverse((p, idx, neighbor)));
}
}
}
}
if sorted_ids.len() != graph.node_count() {
bail!("Cycle detected in tool overrides");
}
let order: HashMap<&str, usize> = sorted_ids
.iter()
.enumerate()
.map(|(i, &id)| (id, i))
.collect();
installed.sort_by_cached_key(|(b, _)| order.get(b.id()).copied().unwrap_or(usize::MAX));
Ok(())
}
pub(crate) async fn which(
&self,
config: &Arc<Config>,
bin_name: &str,
) -> Option<(Arc<dyn Backend>, ToolVersion)> {
let mut installed = self.list_current_installed_versions(config);View on GitHub (pinned to 533346cc37)