jlcodes99/cockpit-tools · error

expected launch path must exist

Error message

expected launch path must exist

What it means

collect_antigravity_process_entries (crates/cockpit-core/src/modules/process_core_matching.rs:1359) runs on Windows inside #[cfg(target_os = "windows")] and calls expected_launch.as_deref().expect("expected launch path must exist") before probing processes via PowerShell. The Option expected_launch holds the resolved Antigravity launch executable path; when the caller's probe could not resolve it, the Option is None and the .expect panics, aborting the process-entry collection used by close_antigravity_instances and resolve_antigravity_pid.

Source

Thrown at crates/cockpit-core/src/modules/process_core_matching.rs:1359

    #[cfg(target_os = "macos")]
    {
        let entries = collect_antigravity_process_entries_macos();
        if !entries.is_empty() {
            return filter_entries_by_expected_launch_path("AG", entries, expected_launch.clone());
        }
        let entries = collect_antigravity_process_entries_from_ps();
        if !entries.is_empty() {
            return filter_entries_by_expected_launch_path("AG", entries, expected_launch.clone());
        }
        // macOS 下避免回退到 sysinfo,防止触发 TCC「其他 App 数据」授权弹窗
        return Vec::new();
    }

    #[cfg(target_os = "windows")]
    {
        let expected = expected_launch
            .as_deref()
            .expect("expected launch path must exist");
        let entries = collect_antigravity_process_entries_from_powershell(expected);
        if !entries.is_empty() {
            return entries;
        }
        if strict_process_detect_enabled() {
            crate::modules::logger::log_warn(
                "[AG Probe] strict mode enabled and PowerShell returned empty; skip sysinfo fallback",
            );
            return Vec::new();
        }
        crate::modules::logger::log_warn(
            "[AG Probe] PowerShell returned empty; fallback to sysinfo probe",
        );
        return collect_antigravity_process_entries_from_sysinfo_fallback(expected);
    }

    #[cfg(target_os = "linux")]
    {

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Verify Antigravity is installed at a standard location and reinstall/repair it if the executable is missing.
  2. Return an empty entry list (or an explicit error) when expected_launch is None instead of unwrapping.
  3. Check the path-resolution code that produces expected_launch and add the custom install directory it misses.
  4. On non-Windows this block is compiled out — confirm the panic actually occurs on a Windows build.

Example fix

// before
let expected = expected_launch.as_deref().expect("expected launch path must exist");
// after
let Some(expected) = expected_launch.as_deref() else {
    crate::modules::logger::log_warn("[Antigravity Probe] launch path unresolved; skipping");
    return Vec::new();
};
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking close/resolve commands, check the launch path resolves:
if (await invoke('resolve_antigravity_launch_path') == null) {
  console.warn('Antigravity launch path not found; skipping process probe');
}

Type guard

fn has_launch_path(expected_launch: &Option<String>) -> bool {
  expected_launch.as_deref().map(|p| !p.trim().is_empty()).unwrap_or(false)
}

Try / catch

match std::panic::catch_unwind(|| collect_antigravity_process_entries()) {
  Ok(entries) => entries,
  Err(_) => { log_warn("probe panicked"); Vec::new() }
}

Prevention

When it happens

Trigger: Calling close_antigravity_instances or resolve_antigravity_pid on Windows when the Antigravity install path cannot be resolved (uninstalled, portable install, non-standard install directory, or registry/FS lookup failure), so expected_launch arrives as None.

Common situations: Antigravity was uninstalled or moved after first run; app installed in a custom directory the resolver doesn't scan; corrupted install metadata; running the close/PID commands before Antigravity was ever launched on the machine.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/60ebbb4fb5107001. Report an issue: GitHub.