jackwener/OpenCLI · error · ArgumentError
must be "like" or "dislike"
Error message
must be "like" or "dislike"
What it means
Thrown by the kimi react command when the positional `kind` argument is anything other than 'like' or 'dislike' (case-insensitive). ArgumentError fires before any navigation or clicking, so this is pure input validation.
Source
Thrown at clis/kimi/chat.js:397
// -------- react --------
cli({
site: 'kimi',
name: 'react',
access: 'write',
description: 'Like or dislike the last assistant message. Pass --conv <id> to target a specific chat.',
domain: KIMI_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
navigateBefore: false,
args: [
{ name: 'kind', positional: true, required: true, help: 'like or dislike' },
{ name: 'conv', required: false, help: 'Chat id or URL' },
],
columns: CHAT_COLUMNS,
func: async (page, kwargs) => {
const kind = String(kwargs?.kind || '').trim().toLowerCase();
if (kind !== 'like' && kind !== 'dislike') throw new ArgumentError('kind', 'must be "like" or "dislike"');
await maybeNavigateConv(page, kwargs?.conv);
const svgName = kind === 'like' ? 'Like' : 'Dislike';
const res = await page.evaluate(clickBySvgNameScript(svgName));
if (!res?.ok) throw new CommandExecutionError(res?.reason || `${kind} button not visible`, '');
return [{ Status: 'clicked', Reaction: kind }];
},
});
// -------- share --------
cli({
site: 'kimi',
name: 'share',
access: 'write',
description: 'Click Share on the last assistant message (opens Kimi\'s share dialog). Pass --conv <id> to target a specific chat.',
domain: KIMI_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',View on GitHub (pinned to 49907e53dc)
Solutions
- Pass exactly 'like' or 'dislike' (any casing) as the kind argument.
- Validate/normalize the intent in your script before invoking react.
- Map alternative user phrasings (thumbs up/down, +1/-1) to the two accepted tokens.
Example fix
// before
await cli('kimi', 'react', { kind: 'thumbs-up' });
// after
const kind = userIntent === 'up' ? 'like' : userIntent === 'down' ? 'dislike' : null;
if (!kind) throw new Error('intent must map to like or dislike');
await cli('kimi', 'react', { kind }); Defensive patterns
Strategy: validation
Validate before calling
function normalizeReaction(kind) {
const k = String(kind ?? '').trim().toLowerCase();
if (k !== 'like' && k !== 'dislike') throw new Error(`kind must be "like" or "dislike", got: ${k}`);
return k;
}
await cli('kimi', 'react', { kind: normalizeReaction(intent) }); Type guard
function isReactionKind(v) { return v === 'like' || v === 'dislike'; } Prevention
- Whitelist intents to the two accepted tokens before calling react.
- Lowercase/trim user-provided values defensively.
- Handle alternative phrasings (thumbs up/down) with an explicit mapping.
When it happens
Trigger: Calling `kimi react` with kind values like 'Like!' , 'thumbs-up', 'up', '1', or an unset variable that stringifies to an empty/other string.
Common situations: Script variables with unexpected casing handled incorrectly (though code lowercases, so casing is fine — the content itself is wrong); passing flag-like values ('--like'); mapping user intents to the wrong token.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- ${label} must be a non-negative integer, got ${JSON.stringif
- limit must be a positive integer
- archive wayback timestamp must be YYYY[MM[DD[hh[mm[ss]]]]] o
- archive wayback url cannot be empty
- bilibili comment ${label} must be a positive integer
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/8100e58d4e037ce4.
Report an issue: GitHub.