Mintplex-Labs/anything-llm · error · Error
key requires <key> argument (e.g. Enter, Tab, Escape)
Error message
key requires <key> argument (e.g. Enter, Tab, Escape)
What it means
Thrown by the 'key' branch of cdp-input.js when process.argv[3] is falsy. The key action dispatches a single keyDown/keyUp pair using either a definition from the specialKeys map (Enter, Tab, Escape, arrows, etc.) or a synthesized {Key<UPPER>} definition, so a key name is mandatory.
Source
Thrown at open-computer/services/interface-service/utils/cdp-input.js:175
key: char,
code: charToCode(char),
unmodifiedText: char,
}, sessionId);
await cdpSend(ws, "Input.dispatchKeyEvent", {
type: "keyUp",
key: char,
code: charToCode(char),
}, sessionId);
await sleep(keystrokeDelay());
}
process.stdout.write(`typed ${text.length} chars`);
} else if (action === "key") {
const key = process.argv[3];
if (!key) throw new Error("key requires <key> argument (e.g. Enter, Tab, Escape)");
const keyDef = specialKeys[key] || { key, code: `Key${key.toUpperCase()}` };
await cdpSend(ws, "Input.dispatchKeyEvent", {
type: "keyDown",
key: keyDef.key,
code: keyDef.code,
windowsVirtualKeyCode: keyDef.keyCode || 0,
nativeVirtualKeyCode: keyDef.keyCode || 0,
}, sessionId);
await sleep(50);
await cdpSend(ws, "Input.dispatchKeyEvent", {
type: "keyUp",
key: keyDef.key,
code: keyDef.code,
windowsVirtualKeyCode: keyDef.keyCode || 0,
nativeVirtualKeyCode: keyDef.keyCode || 0,View on GitHub (pinned to 526360e320)
Solutions
- Pass a key name: `node cdp-input.js key Enter`.
- For special keys use the exact map names: Enter, Tab, Escape, Backspace, Delete, ArrowUp/Down/Left/Right, Home, End, PageUp, PageDown, Space.
- In the caller, assert the key string is non-empty before spawning.
Example fix
// before
spawn('node', ['cdp-input.js', 'key']);
// after
spawn('node', ['cdp-input.js', 'key', 'Enter']); Defensive patterns
Strategy: validation
Validate before calling
if (typeof key !== 'string' || key.length === 0) {
throw new Error('A non-empty key name is required for key action');
} Prevention
- Use exact specialKeys names (Enter, Tab, Escape, ArrowUp, etc.).
- Assert key is non-empty before spawning.
- Document the key action's argv layout: key <key> [target_url].
When it happens
Trigger: Running `node cdp-input.js key` with no key argument. The key must be a recognized special-key name or a single letter; an empty value cannot be mapped to a code.
Common situations: Caller passed an undefined key variable; the key name used a different casing than the specialKeys map (e.g. 'enter' vs 'Enter') — though that would not throw this error, it would synthesize a wrong code.
Related errors
- click requires <x> <y> coordinates
- type requires <text> argument
- No browser pages open.
- No browser tab matching "${targetUrl}". Open tabs: ${openTab
- No webSocketDebuggerUrl — is Chromium running?
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/e1a32eae646143c1.
Report an issue: GitHub.