garrytan/gstack · error · Error

Unknown meta command: ${command}

Error message

Unknown meta command: ${command}

What it means

The `default` branch of the meta-command switch (line 1172). It fires when `handleMetaCommand` is called with a `command` that has no matching `case` — i.e. a string the dispatcher doesn't recognize as a meta command. This usually means the command belongs in `READ_COMMANDS`/`WRITE_COMMANDS` instead, was misrouted, or is a typo.

Source

Thrown at browse/src/meta-commands.ts:1172

      return await handleSkillCommand(args, { port });
    }

    case 'cdp': {
      // Lazy import — cdp-bridge introduces module deps we don't want loaded
      // for projects that never use the CDP escape hatch.
      const { handleCdpCommand } = await import('./cdp-commands');
      return await handleCdpCommand(args, bm);
    }

    case 'memory': {
      // Lazy import — pulls in cdp-bridge + memory-snapshot + buffer accessors
      // that aren't useful for projects that never run the diagnostic.
      const { handleMemoryCommand } = await import('./memory-command');
      return await handleMemoryCommand(args, bm);
    }

    default:
      throw new Error(`Unknown meta command: ${command}`);
  }
}

View on GitHub (pinned to 94993f7401)

Solutions

  1. Confirm the command is actually a meta command (check the `case` labels in handleMetaCommand).
  2. If it's a read/write command, route it through `handleReadCommand`/`handleWriteCommand` instead.
  3. If it's genuinely new, add a `case` for it (and register it in `META_COMMANDS`).
  4. Check for typos or stale references after a rename.

Example fix

// before
await handleMetaCommand('snapsot', args, bm, shutdown, tokenInfo, opts); // typo
// after
await handleMetaCommand('snapshot', args, bm, shutdown, tokenInfo, opts);
Defensive patterns

Strategy: validation

Validate before calling

const META = new Set(['screenshot', 'pdf', 'chain', 'diff', 'state', 'frame', 'ux-audit', 'domain-skill', 'skill', 'cdp', 'memory' /* ... */]);
if (!META.has(command)) {
  throw new Error(`Not a meta command: '${command}'. Route through read/write handlers or add a case.`);
}

Type guard

const isMetaCommand = (s: string): boolean =>
  META_COMMANDS.has(s);

Prevention

When it happens

Trigger: Calling `handleMetaCommand('xyz', ...)` with an unrecognized command name, or a routing layer that forwards non-meta commands into the meta handler.

Common situations: A new command not yet added as a `case`; a rename where callers still use the old name; misrouting by a dispatcher that should have sent the command to read/write handlers.


AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12). Data as JSON: /api/errors/1be0586fa833f20a. Report an issue: GitHub.