jackwener/OpenCLI · error · CommandExecutionError

Failed to fill rename input.

Error message

Failed to fill rename input.

What it means

After opening the rename dialog, the library runs an in-page script that clears the input and inserts the new title via document.execCommand('insertText'). If that script reports failure (returns {ok:false} or a reason), the library throws CommandExecutionError because the rename cannot proceed reliably.

Source

Thrown at clis/codex/rename.js:68

      if (input instanceof HTMLInputElement) {
        const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
        setter.call(input, '');
        input.dispatchEvent(new Event('input', { bubbles: true }));
        setter.call(input, newTitle);
        input.dispatchEvent(new Event('input', { bubbles: true }));
      } else {
        const range = document.createRange();
        range.selectNodeContents(input);
        const sel = window.getSelection();
        sel.removeAllRanges();
        sel.addRange(range);
        document.execCommand('delete');
        document.execCommand('insertText', false, newTitle);
      }
      return { ok: true };
    })()`));
        if (!filled?.ok) {
            throw new CommandExecutionError(filled?.reason || 'Failed to fill rename input.', '');
        }

        await page.pressKey('Enter');
        await waitForConversationPostcondition(
            page,
            action.selected,
            match => (match?.conversation?.title || '').trim() === title,
            'rename',
        );

        return [{
            status: 'renamed',
            title,
            thread_id: action.selected.threadId,
            project: action.selected.project,
        }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — transient re-render races often resolve on a second attempt.
  2. Reload the Codex page, ensure the rename dialog is actually open, then retry.
  3. Check for a Codex UI update that changed the rename input; update the CLI to a version matching the current UI.
  4. Set the title directly in the Codex UI (Rename chat menu) as a manual workaround.
Defensive patterns

Strategy: retry

Validate before calling

await page.waitForSelector('[contenteditable="true"], input:focus', { timeout: 5000 }); // ensure rename input exists before filling

Try / catch

for (let attempt = 0; attempt < 3; attempt++) {
  try {
    await codexRename({ title, ...selection });
    break;
  } catch (e) {
    if (e instanceof CommandExecutionError && /fill rename input/.test(e.message) && attempt < 2) {
      await sleep(1000);
      continue;
    }
    throw e;
  }
}

Prevention

When it happens

Trigger: The rename input element could not be focused/cleared/typed into by the injected script — e.g. the input wasn't editable, the DOM changed between Codex versions, a React re-render replaced the input mid-edit, or the in-page script itself threw and returned a reason instead of {ok:true}.

Common situations: Codex UI update changing the rename dialog markup; slow page where a re-render races the fill; page in a modal/closed state so the input isn't attached; extensions interfering with execCommand.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/050639d5cd52f6e8. Report an issue: GitHub.