jackwener/OpenCLI · error · ArgumentError
is required
Error message
is required
What it means
The kimi history-rename command requires a chat-id positional argument. It validates via parseChatId; if the value is missing, empty, or not a recognizable chat id, it throws ArgumentError('chat-id', 'is required'). The message renders as 'chat-id is required' through the ArgumentError formatting.
Source
Thrown at clis/kimi/audit-extras.js:214
site: 'kimi',
name: 'history-rename',
access: 'write',
description: 'Rename a chat from the /chat/history page (clicks the inline Edit svg next to a chat row, types the new title, and saves). Requires --yes.',
domain: KIMI_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
navigateBefore: false,
args: [
{ name: 'chat-id', positional: true, required: true, help: 'Chat id (UUID-like)' },
{ name: 'new-title', positional: true, required: true, help: 'New title' },
{ name: 'yes', type: 'boolean', default: false, help: 'Actually rename (default: dry-run)' },
],
columns: AUDIT_EXTRA_COLUMNS,
func: async (page, kwargs) => {
const id = parseChatId(kwargs?.['chat-id']);
const newTitle = String(kwargs?.['new-title'] || '').trim();
if (!id) throw new ArgumentError('chat-id', 'is required');
if (!newTitle) throw new ArgumentError('new-title', 'is required');
const yes = kwargs?.yes === true || kwargs?.yes === 'true' || kwargs?.yes === '1';
if (!yes) {
return [{ Status: 'dry-run — pass --yes to rename', ChatId: id, NewTitle: newTitle }];
}
// Navigate to history page
await page.goto(`${KIMI_URL}chat/history`);
await page.wait(2);
// Find the row with href containing the chat id, then click its Edit svg
const clickRes = await page.evaluate(`(() => {
${IS_VISIBLE_JS}
const row = Array.from(document.querySelectorAll('a[href*="/chat/' + ${JSON.stringify(id)} + '"]')).find(isVisible);
if (!row) return { ok: false, reason: 'Chat row not found in history.' };
// The Edit svg is in a sibling or descendant.
let container = row.parentElement || row;
for (let i = 0; i < 4 && container.parentElement; i++) container = container.parentElement;
const editSvg = container.querySelector('svg[name="Edit"]');
if (!editSvg) return { ok: false, reason: 'Edit svg not found near chat row.' };View on GitHub (pinned to 49907e53dc)
Solutions
- Pass a valid chat id: `kimi history-edit <chat-id> <new-title> --yes`
- Copy the id from the chat URL (the segment after /chat/) in full
- If you have a full URL, extract the UUID portion yourself before passing it
- Check shell quoting so the argument isn't swallowed (e.g. ids with special characters)
Example fix
// before
await runCli('kimi history-edit', { 'new-title': 'X', yes: true }); // missing chat-id
// after
const id = '3f2a...uuid'; // from kimi.com/chat/<id>
await runCli('kimi history-edit', { 'chat-id': id, 'new-title': 'X', yes: true }); Defensive patterns
Strategy: validation
Validate before calling
function parseChatId(v) {
const m = String(v || '').match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);
return m ? m[0] : null;
}
const id = parseChatId(rawChatId);
if (!id) throw new Error('chat-id must be a UUID (or a /chat/<uuid> URL)'); Type guard
function hasChatId(k) { return typeof k?.['chat-id'] === 'string' && k['chat-id'].trim().length > 0; } Try / catch
try {
await runCli('kimi history-edit', { 'chat-id': id, 'new-title': title, yes: true });
} catch (e) {
if (e.name === 'ArgumentError' && /chat-id/.test(e.message)) console.error('Supply a valid chat id from the /chat/<id> URL');
else throw e;
} Prevention
- Extract the full UUID from the chat URL before invoking
- Validate UUID shape in your wrapper script
- Check shell quoting so the positional isn't dropped
- Resolve chat ids from `kimi` history listings rather than manual entry
When it happens
Trigger: Running `kimi history-edit` (history-rename) without the chat-id positional, with an empty string, or with a value parseChatId cannot parse (not UUID-like / not extractable from a URL or id form).
Common situations: Copy-pasting a partial id; passing a chat URL where an id was expected but in a format parseChatId doesn't handle; shell quoting dropped the argument; calling the command programmatically with kwargs lacking 'chat-id'.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- keyword must not be empty
- <from> station must not be empty
- <to> station must not be empty
- who 不能为空
- key is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bf1e01b88f6461ca.
Report an issue: GitHub.