jackwener/OpenCLI · error · CommandExecutionError

Rename input fill failed

Error message

Rename input fill failed

What it means

After clicking Edit, history-rename fills the last visible text input with the new title using the native setter, dispatches input/change events, and presses Enter. If the in-page fill script fails (no visible input found, React not picking up the value) it returns {ok:false,reason}, and the command throws CommandExecutionError(reason || 'Rename input fill failed').

Source

Thrown at clis/kimi/audit-extras.js:253

      editBtn.click();
      return { ok: true };
    })()`);
        if (!clickRes?.ok) throw new CommandExecutionError(clickRes?.reason || 'Edit click failed', '');
        await page.wait(0.5);
        // Fill the inline input + submit via Enter
        const fillRes = await page.evaluate(`(() => {
      ${IS_VISIBLE_JS}
      const inputs = Array.from(document.querySelectorAll('input[type="text"], input:not([type])')).filter(isVisible);
      const input = inputs[inputs.length - 1];
      if (!input) return { ok: false, reason: 'No input mounted after clicking Edit.' };
      const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
      setter.call(input, ${JSON.stringify(newTitle)});
      input.dispatchEvent(new Event('input', { bubbles: true }));
      input.dispatchEvent(new Event('change', { bubbles: true }));
      input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
      return { ok: true };
    })()`);
        if (!fillRes?.ok) throw new CommandExecutionError(fillRes?.reason || 'Rename input fill failed', '');
        await page.wait(1);
        const verified = await page.evaluate(`(() => {
      const row = Array.from(document.querySelectorAll('a[href*="/chat/' + ${JSON.stringify(id)} + '"]'))
        .find((el) => (el.innerText || el.textContent || '').includes(${JSON.stringify(newTitle)}));
      return !!row;
    })()`);
        if (!verified) {
            throw new CommandExecutionError(
                `Kimi history rename was not verified for chat ${id}`,
                'The edit input was submitted, but the history row did not show the requested title.',
            );
        }
        return [{ Status: 'renamed', ChatId: id, NewTitle: newTitle }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Increase the wait between the Edit click and the fill (0.5s is often too short) and retry
  2. Inspect the rename UI in a browser — if it's a dialog or contenteditable rather than an <input>, update the fill script's selector (e.g. include [contenteditable] or dialog inputs)
  3. Confirm the preceding Edit click actually succeeded (check the earlier error/log) — a failed click means no input will ever appear
  4. Retry the whole command; transient render timing is the most common cause

Example fix

// before
await page.wait(0.5);
const fillRes = await page.evaluate(fillInputScript(newTitle));
// after
await page.wait(1.5);
let fillRes = await page.evaluate(fillInputScript(newTitle));
if (!fillRes?.ok) { await page.wait(2); fillRes = await page.evaluate(fillInputScript(newTitle)); }
Defensive patterns

Strategy: retry

Validate before calling

const hasInput = await page.evaluate(`(() => {
  const els = Array.from(document.querySelectorAll('input[type="text"], input:not([type])'));
  return els.length > 0;
})()`);
if (!hasInput) throw new Error('No rename input visible — Edit click may have failed or UI changed');

Type guard

function isClickResult(res) { return res != null && typeof res === 'object' && typeof res.ok === 'boolean'; }

Try / catch

try {
  await runCli('kimi history-edit', { 'chat-id': id, 'new-title': t, yes: true });
} catch (e) {
  if (/Rename input fill failed|input/i.test(e.message)) {
    await sleep(2000);
    return runCli('kimi history-edit', { 'chat-id': id, 'new-title': t, yes: true });
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `kimi history-edit <id> <title> --yes` when the inline rename input did not appear after the Edit click (0.5s wait too short), no input[type=text] is visible on the page, or the edit UI renders as a contenteditable/dialog instead of an <input>.

Common situations: Kimi redesigned rename as a modal dialog or prompt() so the input selector misses; slow render after clicking Edit; the click in the prior step silently failed so no input exists; a toast/banner overlays the input making isVisible fail.

Related errors


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