jlcodes99/cockpit-tools · info
[AntigravityRuntime] failed to detect ${target} ${scanMode}
Error message
[AntigravityRuntime] failed to detect ${target} ${scanMode} version: What it means
detectTargetVersion in src/services/antigravityRuntimeService.ts:37 wraps getAntigravityInstalledVersionInfo(target, scanMode) in try/catch. On rejection it warns '[AntigravityRuntime] failed to detect ${target} ${scanMode} version:' and returns false, signaling the runtime version is not detectable. The message is informational; the boolean false drives availability checks like currentQuickAvailable/alternateFullAvailable.
Source
Thrown at src/services/antigravityRuntimeService.ts:37
scanMode,
});
}
function getAlternateAntigravityRuntimeTarget(
target: AntigravityRuntimeTarget,
): AntigravityRuntimeTarget {
return target === 'antigravity_ide' ? 'antigravity' : 'antigravity_ide';
}
async function detectTargetVersion(
target: AntigravityRuntimeTarget,
scanMode: AntigravityInstalledVersionScanMode,
): Promise<boolean> {
try {
const info = await getAntigravityInstalledVersionInfo(target, scanMode);
return !!info?.version;
} catch (error) {
console.warn(
`[AntigravityRuntime] failed to detect ${target} ${scanMode} version:`,
error,
);
return false;
}
}
export async function resolvePreferredAntigravityRuntimeTarget(
currentTarget: AntigravityRuntimeTarget,
): Promise<AntigravityRuntimeTarget> {
const alternateTarget = getAlternateAntigravityRuntimeTarget(currentTarget);
const [currentQuickAvailable, alternateQuickAvailable] = await Promise.all([
detectTargetVersion(currentTarget, 'quick'),
detectTargetVersion(alternateTarget, 'quick'),
]);
if (currentQuickAvailable) {
return currentTarget;View on GitHub (pinned to 1ed8b77992)
Solutions
- Check the warn payload for the underlying invoke error to identify the failing target/scanMode.
- Verify the Antigravity runtime for that target is installed and its executable path exists.
- Retry after an install/upgrade completes, or trigger a rescan of installed versions.
- Treat the returned false as expected when the target is intentionally not installed — it is not a hard failure.
Example fix
// before return false; // after warn // after console.warn(...); const fallback = await getAntigravityInstalledVersionInfo(target, 'full').catch(() => null); return !!fallback?.version;
Defensive patterns
Strategy: fallback
Validate before calling
// Check installation before querying version info:
const installed = await invoke<boolean>('antigravity_is_installed', { target });
if (!installed) return false; Type guard
function hasVersionInfo(info: { version?: string | null } | null): info is { version: string } {
return typeof info?.version === 'string' && info.version.length > 0;
} Try / catch
try {
const info = await getAntigravityInstalledVersionInfo(target, scanMode);
return !!info?.version;
} catch (error) {
console.warn(`[AntigravityRuntime] failed to detect ${target} ${scanMode} version:`, error);
return false;
} Prevention
- Treat false as 'not installed' in availability UIs rather than an error state.
- Rescan installed versions after upgrades complete.
- Confirm install directories are readable by the app (permissions).
When it happens
Trigger: Calling any availability helper (currentQuickAvailable, alternateQuickAvailable, currentFullAvailable, alternateFullAvailable) when the backend version-info command rejects — runtime binary missing, install path unreadable, unsupported scan mode, or IPC failure.
Common situations: Antigravity not installed or partially upgraded so version metadata is absent; permission errors reading the install directory; stale cached install path after an update; running in a non-Tauri context where invoke fails.
Related errors
- [AntigravityRuntime] failed to resolve preferred target:
- [WebDAV] Auto backup upload failed
- [TraeAutoCheckin] 保存配置失败:
- [CodexExport] get downloads dir failed:
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/2c89842fe6b850c3.
Report an issue: GitHub.