{"record":{"id":"4647e7cb1eb00184","repo":"jdx/mise","slug":"brew-cask-unsupported-target-type-4647e7","errorCode":null,"errorMessage":"brew-cask: unsupported target type '{}'","messagePattern":"brew-cask: unsupported target type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/state.rs","lineNumber":453,"sourceCode":"        let target = std::fs::read_link(path)?;\n        return Ok(CaskTargetFingerprint {\n            kind: CaskTargetKind::Symlink,\n            digest: hex::encode(Sha256::digest(target.as_os_str().as_encoded_bytes())),\n        });\n    }\n    if metadata.is_file() {\n        return Ok(CaskTargetFingerprint {\n            kind: CaskTargetKind::File,\n            digest: hash::file_hash_sha256(path, None)?,\n        });\n    }\n    if metadata.is_dir() {\n        return Ok(CaskTargetFingerprint {\n            kind: CaskTargetKind::Directory,\n            digest: cask_directory_digest(path)?,\n        });\n    }\n    bail!(\"brew-cask: unsupported target type '{}'\", path.display())\n}\n\n/// Content identity intentionally excludes timestamps, ownership, and modes.\n/// It hashes stable relative paths, entry kinds, file bytes, and link targets\n/// without following symlinks.\npub(super) fn cask_directory_digest(root: &Path) -> Result<String> {\n    let mut entries = WalkDir::new(root)\n        .follow_links(false)\n        .into_iter()\n        .collect::<std::result::Result<Vec<_>, _>>()?;\n    entries.sort_by(|a, b| a.path().cmp(b.path()));\n    let mut digest = Sha256::new();\n    for entry in entries {\n        let path = entry.path();\n        let relative = path.strip_prefix(root)?;\n        if relative.as_os_str().is_empty() {\n            continue;\n        }","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/cask/state.rs#L435-L471","documentation":"cask_target_fingerprint computes a content identity for an installed cask artifact: a digest for directories, a kind marker for files/symlinks. If the path is neither a directory, file, nor symlink (e.g. a device, socket, or fifo), mise has no fingerprinting strategy and refuses rather than produce an unsound identity used for adoption/prune safety decisions.","triggerScenarios":"install_app or validate_adoptable_apps (and CaskTargetRecord / cask_target_record_matches / staged_target_matches) fingerprint a target path whose metadata.is_dir() is false and whose file type is neither file nor symlink — e.g. a socket, fifo, or device node present at an artifact target path.","commonSituations":"A cask's app target path was replaced by a Unix socket or FIFO by some tool; a broken filesystem state or unusual mount left a special file where a regular artifact should live.","solutions":["Inspect the path (`ls -l`, `stat`) and remove or replace the special file with the expected artifact.","Reinstall the cask (`brew reinstall --cask <token>`) so Homebrew recreates the correct file/directory.","If the special file is intentional, exclude it from cask artifact targets rather than trying to fingerprint it."],"exampleFix":"// before: a fifo where the app bundle belongs\n$ ls -l /Applications/MyApp.app\nprw-r--r--  MyApp.app\n\n// after\n$ rm /Applications/MyApp.app && brew reinstall --cask myapp","handlingStrategy":"validation","validationCode":"let ft = std::fs::symlink_metadata(path)?.file_type();\nif !(ft.is_dir() || ft.is_file() || ft.is_symlink()) {\n    // special file at target path; resolve before installing/pruning\n}","typeGuard":"fn is_fingerprintable(p: &Path) -> bool {\n    std::fs::symlink_metadata(p).map(|m| {\n        let ft = m.file_type();\n        ft.is_dir() || ft.is_file() || ft.is_symlink()\n    }).unwrap_or(false)\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"unsupported target type\") => {\n        remove_special_file(path)?; reinstall_cask(token)\n    }\n    r => r,\n}","preventionTips":["Don't let daemons create sockets/fifos inside application bundle paths.","Verify artifact target paths are regular files/dirs before cask operations.","Reinstall casks whose target paths look unusual (`ls -l`)."],"tags":["cask","fingerprint","filesystem","unsupported-type"],"backgroundTag":"unsupported-operation","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"}