{"record":{"id":"b214b8e914294426","repo":"jdx/mise","slug":"brew-cask-structured-file-operation-must-use-stag-b214b8","errorCode":null,"errorMessage":"brew-cask: structured file operation must use staged_path","messagePattern":"brew-cask: structured file operation must use staged_path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/flight.rs","lineNumber":1055,"sourceCode":"                );\n            }\n            matches.push(path);\n        }\n    }\n    matches.sort();\n    matches.dedup();\n    Ok(matches)\n}\n\npub(super) fn is_flight_glob(path: &str) -> bool {\n    path.chars()\n        .any(|c| matches!(c, '*' | '?' | '[' | ']' | '{' | '}'))\n}\n\npub(super) fn resolve_flight_path(staged_path: &Path, path: &FlightPath) -> Result<PathBuf> {\n    match path.base {\n        FlightPathBase::StagedPath => {}\n        _ => bail!(\"brew-cask: structured file operation must use staged_path\"),\n    }\n    let relative = Path::new(&path.path);\n    validate_flight_relative_path(&path.path)?;\n    Ok(staged_path.join(relative))\n}\n\npub(super) fn resolve_flight_path_with_context(\n    cask: &Cask,\n    path: &FlightPath,\n    staged_path: &Path,\n    appdir: &Path,\n) -> Result<PathBuf> {\n    let expanded = expand_flight_template(cask, &path.path, staged_path, appdir);\n    match path.base {\n        FlightPathBase::StagedPath => {\n            validate_flight_relative_path(&expanded)?;\n            Ok(staged_path.join(expanded))\n        }","sourceCodeStart":1037,"sourceCodeEnd":1073,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/flight.rs#L1037-L1073","documentation":"Structured cask flight operations (move/symlink/etc.) must reference paths relative to the cask's `staged_path` base. Homebrew throws this when a FlightPath declares any other base (e.g. an absolute or home-relative base), which the structured API forbids by design.","triggerScenarios":"A cask stanza passes a FlightPath whose `base` is not `FlightPathBase::StagedPath` — e.g. specifying an absolute path or another base variant in a structured move/symlink operation.","commonSituations":"Cask DSL authors porting old-style stanzas to the structured API and leaving an absolute path as base; internal tooling generating flight steps with the wrong base enum.","solutions":["Set the FlightPath base to StagedPath","Express the target as a path relative to staged_path","For operations outside staging, use the appropriate non-structured stanza or artifact DSL instead"],"exampleFix":"// before\nFlightPath { base: FlightPathBase::Absolute, path: \"/opt/tool/bin/x\" }\n// after\nFlightPath { base: FlightPathBase::StagedPath, path: \"bin/x\" }","handlingStrategy":"type-guard","validationCode":"if fp.base != FlightPathBase::StagedPath {\n    return Err(\"structured flight op must use staged_path\".into());\n}","typeGuard":"fn is_staged_base(fp: &FlightPath) -> bool {\n    matches!(fp.base, FlightPathBase::StagedPath)\n}","tryCatchPattern":"match resolve_flight_path(staged, &fp) {\n    Err(e) if e.to_string().contains(\"must use staged_path\") => fix_base_and_retry(),\n    r => r,\n}","preventionTips":["Always construct FlightPath with FlightPathBase::StagedPath in structured DSL","Convert legacy absolute paths to staged-relative equivalents","Add unit tests asserting base == StagedPath for generated flight steps"],"tags":["brew","cask","invalid-argument","packaging"],"backgroundTag":"invalid-argument-value","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"}