jackwener/OpenCLI · warning · ArgumentError

kind

Error message

kind

What it means

The antigravity 'good'/'bad' reaction command validates its required positional 'kind' argument and throws ArgumentError (src/errors.ts:128, code 'ARGUMENT', exit code USAGE_ERROR) when the value is anything other than 'good' or 'bad' after trimming and lowercasing. This library throws it up-front to fail fast with a usage hint instead of attempting a doomed page click. It is a caller-input error, not a browser or page problem.

Source

Thrown at clis/antigravity/audit-extras.js:82

  })()`;
}

// -------- react --------
cli({
    site: 'antigravity',
    name: 'react',
    access: 'write',
    description: 'Click "Good response" or "Bad response" on the LAST assistant message.',
    domain: '127.0.0.1',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'kind', positional: true, required: true, help: 'good or bad' },
    ],
    columns: ['Status', 'Reaction'],
    func: async (page, kwargs) => {
        const kind = String(kwargs?.kind || '').trim().toLowerCase();
        if (kind !== 'good' && kind !== 'bad') throw new ArgumentError('kind', 'must be "good" or "bad"');
        const label = kind === 'good' ? 'Good response' : 'Bad response';
        const res = unwrapEvaluateResult(await page.evaluate(clickLastScript([`button[aria-label="${label}"]`])));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || `${label} click failed`, '');
        return [{ Status: 'clicked', Reaction: kind }];
    },
});

// -------- copy-message --------
cli({
    site: 'antigravity',
    name: 'copy-message',
    access: 'write',
    description: 'Return the text of the last assistant message (best-effort: walks up from the last visible Copy button).',
    domain: '127.0.0.1',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'click-button', type: 'boolean', default: false, help: 'Also click the in-UI Copy button' },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run with exactly 'good' or 'bad' as the positional argument (case and surrounding whitespace do not matter).
  2. Quote the argument in your shell: antigravity <cmd> "good" to avoid splitting or interpolation.
  3. If driven by a script, assert the variable is non-empty and one of the two tokens before invoking the command.
  4. Check `help` output for the command to confirm the accepted values ('good or bad').

Example fix

// before
antigravity react thumbs-up

// after
antigravity react good
Defensive patterns

Strategy: validation

Validate before calling

const kind = String(process.argv[3] || '').trim().toLowerCase();
if (kind !== 'good' && kind !== 'bad') {
  throw new Error(`kind must be "good" or "bad", got: ${JSON.stringify(kind)}`);
}

Type guard

function isReactionKind(v) {
  return typeof v === 'string' && ['good', 'bad'].includes(v.trim().toLowerCase());
}

Try / catch

try {
  await runCmd('antigravity react', kind);
} catch (e) {
  if (e.code === 'ARGUMENT') {
    console.error(`Usage: pass "good" or "bad" (got "${kind}")`);
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: Running the command with kind set to anything besides 'good' or 'bad': e.g. `like`, `thumbs-up`, `Good!`, an empty string, or a shell-mangled value like 'goo d'. The check is `kind !== 'good' && kind !== 'bad'` after `String(kwargs?.kind || '').trim().toLowerCase()`.

Common situations: Users guessing the accepted vocabulary (typing 'up'/'down' or 'positive'/'negative'); scripts interpolating empty variables so kind becomes ''; automation passing display labels like 'Good response' instead of the bare token 'good'; shell quoting stripping or splitting the argument.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/d65a84632646893c. Report an issue: GitHub.