{"record":{"id":"1b8a2d4969f77979","repo":"jdx/mise","slug":"task-task-name-input-group-cycle","errorCode":null,"errorMessage":"task {task_name} input group cycle: {}","messagePattern":"task (.+?) input group cycle: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/mod.rs","lineNumber":3817,"sourceCode":"    anchor_literals: bool,\n) -> Result<Vec<String>> {\n    let mut expanded = vec![];\n    for entry in entries {\n        let Some(group) = entry.strip_prefix(TASK_INPUT_GROUP_PREFIX) else {\n            expanded.push(if anchor_literals {\n                anchor_task_input(root, entry)\n            } else {\n                entry.clone()\n            });\n            continue;\n        };\n        let (inputs, group_root) = task_inputs.input_groups.get(group).ok_or_else(|| {\n            eyre!(\"task {task_name} references undefined input group {group:?} with {entry:?}\")\n        })?;\n        if let Some(cycle_start) = stack.iter().position(|name| name == group) {\n            let mut cycle = stack[cycle_start..].to_vec();\n            cycle.push(group.to_string());\n            bail!(\n                \"task {task_name} input group cycle: {}\",\n                cycle.iter().join(\" -> \")\n            );\n        }\n        stack.push(group.to_string());\n        expanded.extend(expand_task_inputs(\n            inputs,\n            task_inputs,\n            group_root,\n            task_name,\n            stack,\n            true,\n        )?);\n        stack.pop();\n    }\n    Ok(expanded)\n}\n","sourceCodeStart":3799,"sourceCodeEnd":3835,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/config/mod.rs#L3799-L3835","documentation":"A task's inputs reference an input group in a way that forms a cycle: expanding group A requires group B which (transitively) requires A again. mise reports the full cycle path to help locate the loop.","triggerScenarios":"During task input expansion (expand_task_inputs) when walking input_groups, the group being entered is already present in the stack — e.g. group \"all\" includes \"build\" which includes \"all\". Groups can also be undefined, but this specific error fires only on a genuine cycle.","commonSituations":"Refactoring task inputs where group A was changed to depend on group B while B already depended on A; copy-pasting group definitions creating self-references (a group including itself).","solutions":["Break the cycle: remove the group reference that loops back (the cycle path in the message shows the loop: A -> B -> A)","If the group should be a leaf, replace its group reference with concrete input paths","Deduplicate shared inputs into a separate group that both A and B reference instead of referencing each other"],"exampleFix":"// before\n[input_groups]\nall = [\"group:build\"]\nbuild = [\"group:all\"]\n// after\n[input_groups]\nall = [\"group:build\", \"docs/**\"]\nbuild = [\"src/**/*.rs\"]","handlingStrategy":"validation","validationCode":"// pre-validate input group graph for cycles before expansion (DFS)\nfn has_cycle(groups: &HashMap<String, Vec<String>>) -> bool {\n    fn dfs(g: &str, groups: &HashMap<String, Vec<String>>, stack: &mut Vec<String>) -> bool {\n        if stack.contains(&g.to_string()) { return true; }\n        stack.push(g.to_string());\n        for dep in groups.get(g).into_iter().flatten() {\n            if let Some(next) = dep.strip_prefix(\"group:\") {\n                if dfs(next, groups, stack) { return true; }\n            }\n        }\n        stack.pop();\n        false\n    }\n    groups.keys().any(|k| dfs(k, groups, &mut vec![]))\n}","typeGuard":"// Rust\nfn is_group_ref(entry: &str) -> Option<&str> {\n    entry.strip_prefix(\"group:\")\n}","tryCatchPattern":"// Rust\nmatch expand_task_inputs(...) {\n    Ok(inputs) => use(inputs),\n    Err(e) if e.to_string().contains(\"input group cycle\") => {\n        eprintln!(\"break the loop shown in the message (A -> B -> A)\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Draw the input-group dependency graph when defining nested groups","Never let a group reference itself directly or transitively","Put shared inputs into a common leaf group instead of cross-referencing groups"],"tags":["config","task","cycle","dependency-graph"],"backgroundTag":"circular-dependency","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}