{"record":{"id":"9636ac01bb35efb4","repo":"jdx/mise","slug":"brew-cask-unsupported-generic-artifact-type-9636ac","errorCode":null,"errorMessage":"brew-cask: unsupported generic artifact type: {}","messagePattern":"brew-cask: unsupported generic artifact type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/mod.rs","lineNumber":1819,"sourceCode":"            copy_cask_artifact_at(&entry.path(), &fd, &entry.file_name())?;\n        }\n        nix::sys::stat::fchmod(&fd, mode)?;\n    } else if metadata.is_file() {\n        let destination = nix::fcntl::openat(\n            parent,\n            name,\n            nix::fcntl::OFlag::O_WRONLY\n                | nix::fcntl::OFlag::O_CREAT\n                | nix::fcntl::OFlag::O_EXCL\n                | nix::fcntl::OFlag::O_NOFOLLOW,\n            nix::sys::stat::Mode::S_IRUSR | nix::sys::stat::Mode::S_IWUSR,\n        )?;\n        let mut source = std::fs::File::open(from)?;\n        let mut destination = std::fs::File::from(destination);\n        copy_file_contents(&mut source, &mut destination)?;\n        nix::sys::stat::fchmod(&destination, mode)?;\n    } else {\n        bail!(\n            \"brew-cask: unsupported generic artifact type: {}\",\n            from.display()\n        );\n    }\n    Ok(())\n}\n\n#[cfg(all(unix, target_os = \"macos\"))]\nfn copy_file_contents(from: &mut std::fs::File, to: &mut std::fs::File) -> Result<()> {\n    use std::os::fd::AsRawFd;\n\n    // SAFETY: both descriptors remain open for the call and fcopyfile does not\n    // retain them. A null state requests the default copyfile state.\n    let result = unsafe {\n        nix::libc::fcopyfile(\n            from.as_raw_fd(),\n            to.as_raw_fd(),\n            std::ptr::null_mut(),","sourceCodeStart":1801,"sourceCodeEnd":1837,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/mod.rs#L1801-L1837","documentation":"This error comes from the generic artifact copy routine: after handling the recognized artifact kinds (the `if` branches above, e.g. regular files with an explicit mode), the `else` branch rejects any other filesystem object type passed as a cask artifact. The library only supports copying artifact types it explicitly implements; anything else (directories, sockets, FIFOs, device nodes, or unrecognized artifact declarations) is refused rather than copied unsafely.","triggerScenarios":"Invoking a cask install/artifact-staging path whose source `from` path is a filesystem object not matching any supported artifact branch — e.g. a directory, symlink, socket, or FIFO, or a cask artifact stanza mapping to an unsupported type — reaching the final `else` of the copy dispatcher.","commonSituations":"A cask's artifact list contains an entry type the implementation does not support (e.g. a `binary`/`preflight` style stanza routed into the generic copier); a staged artifact tree contains special files created by an upstream script; a partially-extracted archive left a socket or FIFO where a regular file was expected.","solutions":["Identify what `from` actually is (`ls -la` / `stat` on the printed path) and confirm which artifact type produced it.","If the cask declares an artifact type this implementation lacks, use a cask variant whose artifacts are all supported kinds, or implement/handle that artifact type explicitly in the dispatcher instead of falling into the generic branch.","If the source is corrupt leftover data (socket/FIFO), clean the staging area and re-download/re-extract the cask artifact.","Re-run with a newer version of the library in case support for the artifact type was added upstream."],"exampleFix":"// before: generic fallthrough for any path\n} else {\n    bail!(\"brew-cask: unsupported generic artifact type: {}\", from.display());\n}\n// after: handle the type explicitly before the fallthrough\n} else if metadata.is_dir() {\n    copy_dir_recursively(from, destination, mode)?;\n} else {\n    bail!(\"brew-cask: unsupported generic artifact type: {}\", from.display());\n}","handlingStrategy":"validation","validationCode":"use std::fs;\nfn artifact_type_supported(from: &std::path::Path) -> bool {\n    match fs::symlink_metadata(from) {\n        Ok(md) => md.is_file(),\n        Err(_) => false,\n    }\n}\n","typeGuard":"fn is_regular_file(p: &std::path::Path) -> bool {\n    std::fs::symlink_metadata(p).map(|m| m.is_file()).unwrap_or(false)\n}\n","tryCatchPattern":null,"preventionTips":["Only pass regular-file artifacts through the generic copy path.","Inspect cask artifact stanzas for unsupported types before running installs.","Keep the library updated so newly supported artifact types are available."],"tags":["unsupported-operation","filesystem","artifacts"],"backgroundTag":"unsupported-operation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}