thedotmack/claude-mem · error

Unknown Antigravity CLI event

Error message

Unknown Antigravity CLI event: ${antigravityEventName}

What it means

buildHookCommand maps Antigravity CLI event names (e.g. from ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT) to internal events. If passed an event name not present in that mapping table, it throws to prevent installing a hook command that would silently do nothing. This is an internal allow-list check over the supported Antigravity events.

Solutions

  1. Use only event names listed in ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT.
  2. If a new Antigravity event exists, add it to the mapping table and update the code.
  3. Check for case/typo mismatches between the CLI's event name and the mapping key.
  4. Upgrade claude-mem to a version that supports the new Antigravity event set.

Example fix

// before
const EVENT_TO_INTERNAL = { SessionStart: 'session_start', SessionEnd: 'session_end' };
buildHookCommand(bun, worker, 'PostToolUse'); // throws

// after
const EVENT_TO_INTERNAL = { SessionStart: 'session_start', SessionEnd: 'session_end', PostToolUse: 'post_tool_use' };
Defensive patterns

Strategy: validation

Validate before calling

if (!(eventName in ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT)) {
  throw new Error(`Unsupported Antigravity event: ${eventName}`);
}

Type guard

function isAntigravityEvent(name: string): name is keyof typeof ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT {
  return name in ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT;
}

Try / catch

try {
  cmd = buildHookCommand(bunPath, workerPath, event);
} catch (e) {
  logger.warn(`Skipping unsupported Antigravity event ${event}: ${e.message}`);
  return null;
}

Prevention

When it happens

Trigger: Calling buildHookCommand with an event name that is not a key of ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT — e.g. after Antigravity added a new lifecycle event the installer does not yet know, or a typo in the event name.

Common situations: Antigravity CLI version upgrade introducing new event names, hand-edited hook config referencing an unsupported event, or a typo like 'afterEdit' vs 'AfterEdit'.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/b931868b89983469. Report an issue: GitHub.

Appendix: source

Thrown at src/services/integrations/AntigravityCliHooksInstaller.ts:138

      logger.error('WORKER', 'Failed to resolve Windows 8.3 short path', { path: filePath }, error);
    }
  }
  console.warn(
    `  WARNING: Antigravity CLI hook path contains spaces and 8.3 short-path\n` +
    `  resolution failed: ${filePath}\n` +
    `  agy splits commands on spaces, so hooks may fail to launch.`,
  );
  return filePath;
}

function buildHookCommand(
  bunPath: string,
  workerServicePath: string,
  antigravityEventName: string,
): string {
  const internalEvent = ANTIGRAVITY_EVENT_TO_INTERNAL_EVENT[antigravityEventName];
  if (!internalEvent) {
    throw new Error(`Unknown Antigravity CLI event: ${antigravityEventName}`);
  }

  // Emit bare, forward-slashed paths (see toSpaceFreePath): agy does not run the
  // command through a shell, so quotes are taken literally and backslashes are
  // fragile.
  const formattedBunPath = toSpaceFreePath(bunPath).replace(/\\/g, '/');
  const formattedWorkerPath = toSpaceFreePath(workerServicePath).replace(/\\/g, '/');

  return `${formattedBunPath} ${formattedWorkerPath} hook antigravity-cli ${internalEvent}`;
}

function createHookGroup(hookCommand: string): AntigravityHookGroup {
  return {
    matcher: '*',
    hooks: [{
      name: HOOK_NAME,
      type: 'command',
      command: hookCommand,

View on GitHub (pinned to d8bc9755e7)