jdx/mise · error
brew-cask: ' ' is ambiguous
Error message
brew-cask: {kind} '{name}' is ambiguous: {} What it means
When resolving a cask artifact by name (e.g. an APPDIR artifact), single_match expects zero or exactly one match among candidate paths. If multiple paths match the requested kind/name, the selection is ambiguous, so it bails listing all matching paths. The doc comment shows the produced message, e.g. "brew-cask: APPDIR artifact 'x' is ambiguous: a, b".
Solutions
- Use a more specific artifact name in the cask definition so exactly one staged path matches.
- Inspect the listed matching paths and remove/rename the duplicate in the staged caskroom.
- Update the cask definition to reflect the upstream artifact layout after a cask version change.
- If the ambiguity comes from stale staging, uninstall and reinstall the cask to rebuild a clean caskroom.
Example fix
// before (ambiguous artifact name) [[artifacts.appdir]] name = "MyApp" // after (unique name) [[artifacts.appdir]] name = "MyApp.app"
Defensive patterns
Strategy: validation
Validate before calling
use std::path::PathBuf;
fn unambiguous(matches: &[PathBuf]) -> bool {
matches.len() <= 1
}
// only proceed to single_match when this returns true; otherwise narrow the name Try / catch
// Rust
match resolve_cask_artifact(&cask, kind, name) {
Err(e) if e.to_string().contains("is ambiguous") => {
// parse listed paths from the message or re-glob with a stricter name
}
other => other,
} Prevention
- Use fully qualified artifact names (e.g. 'MyApp.app' not 'MyApp') in cask definitions.
- After upstream cask updates, verify the artifact list for new colliding entries.
- Keep the caskroom clean: reinstall rather than mixing versions in one directory.
- Test artifact resolution with glob patterns that could match multiple paths.
When it happens
Trigger: Calling single_match (via the artifact resolution used by cask install/linking) with a kind/name that matches two or more staged paths in the `matches` slice — e.g. a glob or name pattern that hits several files/directories in the staged cask.
Common situations: A cask stages multiple artifacts whose names collide or both match the requested target (e.g. duplicate app bundles, case differences, an app plus a similarly named directory); a cask definition's artifact name is too generic after an upstream cask update added another matching entry.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- brew-cask: completion executable
- ambiguous variants for
- brew-cask: ' ' must be an absolute path
- brew-cask: ' ' must not contain '..
- brew-cask: ' ' must not resolve to the filesystem root
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/c7e53d678a0d5c2c.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/brew/cask/mod.rs:3037
continue;
}
let path = target.join(&suffix);
if path.is_file() {
matches.push(path);
}
}
matches.sort();
matches.dedup();
single_match(&matches, "APPDIR artifact", source)
}
/// `kind` and `name` build the ambiguity error, e.g. "brew-cask: APPDIR
/// artifact 'x' is ambiguous: a, b".
fn single_match(matches: &[PathBuf], kind: &str, name: &str) -> Result<Option<PathBuf>> {
match matches {
[] => Ok(None),
[path] => Ok(Some(path.clone())),
_ => bail!(
"brew-cask: {kind} '{name}' is ambiguous: {}",
matches
.iter()
.map(|path| path.display().to_string())
.collect::<Vec<_>>()
.join(", ")
),
}
}
fn find_generated_completion_file(root: &Path, executable: &str) -> Result<Option<PathBuf>> {
let executable_path = Path::new(executable);
let direct = root.join(executable_path);
if direct.is_file() {
return Ok(Some(direct));
}
let matches = find_file_artifacts(root, executable_path);
single_match(&matches, "completion executable", executable)View on GitHub (pinned to 533346cc37)