{"record":{"id":"31a3520bef33ec09","repo":"jackwener/OpenCLI","slug":"inserttext-returned-no-inserted-flag-command-may","errorCode":null,"errorMessage":"insertText returned no inserted flag — command may not be supported by the extension","messagePattern":"insertText returned no inserted flag — command may not be supported by the extension","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/browser/page.ts","lineNumber":326,"sourceCode":"   */\n  async setFileInput(files: string[], selector?: string): Promise<void> {\n    const result = await sendCommand('set-file-input', {\n      files,\n      selector,\n      ...this._cmdOpts(),\n    }) as { count?: number };\n    if (!result?.count) {\n      throw new Error('setFileInput returned no count — command may not be supported by the extension');\n    }\n  }\n\n  async insertText(text: string): Promise<void> {\n    const result = await sendCommand('insert-text', {\n      text,\n      ...this._cmdOpts(),\n    }) as { inserted?: boolean };\n    if (!result?.inserted) {\n      throw new Error('insertText returned no inserted flag — command may not be supported by the extension');\n    }\n  }\n\n  async frames(): Promise<Array<{ index: number; frameId: string; url: string; name: string }>> {\n    const result = await sendCommand('frames', { ...this._cmdOpts() });\n    return Array.isArray(result) ? result : [];\n  }\n\n  async evaluateInFrame(js: string, frameIndex: number): Promise<unknown> {\n    const code = buildEvaluateExpression(js);\n    return sendCommand('exec', { code, frameIndex, ...this._cmdOpts() });\n  }\n\n  async cdp(method: string, params: Record<string, unknown> = {}): Promise<unknown> {\n    return sendCommand('cdp', {\n      cdpMethod: method,\n      cdpParams: params,\n      ...this._cmdOpts(),","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/browser/page.ts#L308-L344","documentation":"insertText sends the 'insert-text' command through the extension and expects an { inserted: true } result. A missing/falsy inserted flag means the command returned nothing usable, interpreted as the extension not supporting insert-text.","triggerScenarios":"Calling page.insertText(text) when the extension's response has no truthy inserted property — typically an outdated extension lacking the insert-text handler, or the target element not being editable.","commonSituations":"Running with an older extension after upgrading the CLI; inserting into a non-focused or non-editable element so the handler reports failure without a proper error.","solutions":["Update/reload the OpenCLI Chrome extension to the newest version","Ensure focus is on an editable element before calling insertText","Fall back to keyboard-based typing APIs if insert-text is unsupported"],"exampleFix":"// before\nawait page.insertText('hello');\n// after\nawait page.click(selector); // focus the editable element first\nawait page.insertText('hello');","handlingStrategy":"fallback","validationCode":"const editable = await page.evaluate(\"!!document.activeElement && (document.activeElement as HTMLElement).isContentEditable || /INPUT|TEXTAREA/.test(document.activeElement?.tagName || '')\");\nif (!editable) await page.click(targetSelector);","typeGuard":"function confirmsInsert(r: { inserted?: boolean } | null): r is { inserted: true } { return r?.inserted === true; }","tryCatchPattern":"try { await page.insertText(text); }\ncatch (e) {\n  if (String(e.message).includes('no inserted flag')) {\n    await page.keyboard.type(text); // fallback\n  } else throw e;\n}","preventionTips":["Update the extension to the latest version","Focus an editable element before inserting text","Test insert-text after each extension update"],"tags":["extension","browser-automation","version-compatibility"],"backgroundTag":"unsupported-command","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}