{"record":{"id":"87044b9c61fb740b","repo":"Hmbown/CodeWhale","slug":"unknown-key-combination-text-win32","errorCode":null,"errorMessage":"unknown key combination \"${text}\"","messagePattern":"unknown key combination \"(.+?)\"","errorType":"exception","errorClass":"ExecError","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/src/backends/win32.mjs","lineNumber":244,"sourceCode":"      for (const code of keys) heldKeys.delete(code);\n      return result;\n    } catch (failure) {\n      try { await releaseInput({ buttons: [], keys }); }\n      catch (cleanup) {\n        throw Object.assign(new ExecError(`Keyboard input failed: ${failure.message}; release failed: ${cleanup.message}`, failure.result), {\n          code: failure.code, cause: failure, cleanupError: cleanup,\n        });\n      }\n      throw failure;\n    }\n  }\n\n  function keyChord(text) {\n    const parts = String(text).split(\"+\").map((part) => part.trim().toLowerCase());\n    const key = parts.pop();\n    const mods = parts.map((part) => MODVK[part]);\n    const vk = VK[key] ?? MODVK[key] ?? (/^[a-z0-9]$/.test(key) ? key.toUpperCase().charCodeAt(0) : null);\n    if (vk == null || mods.some((mod) => mod == null)) throw new ExecError(`unknown key combination \"${text}\"`);\n    return { key, vk, mods: [...new Set(mods)] };\n  }\n\n  /** Self-contained User32 invocation: prelude + script, fails truthfully. */\n  async function withUser32(script, opts) {\n    return psOk(`${USER32_PRELUDE}\\n${script}`, opts);\n  }\n\n  return {\n    platform: \"win32\",\n    releaseInput,\n    browser_start: browser.start,\n    browser_status: browser.status,\n    browser_navigate: browser.navigate,\n    browser_click: browser.click,\n    browser_type: browser.type,\n    browser_screenshot: browser.screenshot,\n    browser_stop: browser.stop,","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/backends/win32.mjs#L226-L262","documentation":"keyChord parses a human key-combination string like \"ctrl+shift+t\" into a Windows virtual-key chord for the win32 computer-use backend. It throws this ExecError when either the final key or any modifier token cannot be resolved to a virtual-key code (MODVK/VK lookup fails and it isn't a single alphanumeric).","triggerScenarios":"Calling a key/key_combo action with an unrecognized key name (e.g. \"cmd+c\" instead of \"win+c\", \"prtscn\", \"f13\"), an empty string, a trailing \"+\", or an unknown modifier token.","commonSituations":"Porting macOS/Linux key names (\"cmd\", \"super\", \"option\") to the Windows backend; typos like \"contrl\"; passing multi-character keys the VK table lacks; agents inventing key names.","solutions":["Use key names the backend recognizes: win/meta instead of cmd/super, alt instead of option, ctrl/shift/alt as modifiers","Use single characters a-z0-9 directly (\"ctrl+a\") or check the VK/MODVK tables in win32.mjs for supported names","Trim whitespace and ensure format is modifier+modifier+key with exactly one final key","Catch ExecError and surface the supported key vocabulary to the calling agent"],"exampleFix":"// before\nawait key(\"cmd+c\");\n// after\nawait key(\"win+c\");","handlingStrategy":"validation","validationCode":"const KEY_RE = /^[a-z0-9]+(\\+[a-z0-9]+)*$/i;\nconst KNOWN_MODS = [\"ctrl\",\"alt\",\"shift\",\"win\"];\nfunction isValidChord(text) {\n  if (typeof text !== \"string\" || !KEY_RE.test(text.trim())) return false;\n  const parts = text.toLowerCase().split(\"+\");\n  const key = parts.pop();\n  return /^[a-z0-9]$/.test(key) || KNOWN_MODS.includes(key) || parts.every(p => KNOWN_MODS.includes(p));\n}","typeGuard":"function isString(v) { return typeof v === \"string\"; }\nconst isKnownChord = (t) => isString(t) && isValidChord(t);","tryCatchPattern":"try {\n  await backend.key(\"ctrl+shift+t\");\n} catch (e) {\n  if (String(e.message).startsWith(\"unknown key combination\")) {\n    throw new Error(`Unsupported key: use names like ctrl/alt/shift/win plus a-z0-9. Got: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Stick to ctrl/alt/shift/win modifiers and single alphanumeric keys","Never use mac-style names (cmd, option) on the Windows backend","Validate chords against the VK/MODVK vocabulary before dispatch","Trim inputs and reject empty or trailing '+' segments"],"tags":["input","validation","windows"],"backgroundTag":"invalid-enum-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}