{"record":{"id":"75a4160cb660be13","repo":"jackwener/OpenCLI","slug":"rename-input-fill-failed","errorCode":null,"errorMessage":"Rename input fill failed","messagePattern":"Rename input fill failed","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/kimi/audit-extras.js","lineNumber":253,"sourceCode":"      editBtn.click();\n      return { ok: true };\n    })()`);\n        if (!clickRes?.ok) throw new CommandExecutionError(clickRes?.reason || 'Edit click failed', '');\n        await page.wait(0.5);\n        // Fill the inline input + submit via Enter\n        const fillRes = await page.evaluate(`(() => {\n      ${IS_VISIBLE_JS}\n      const inputs = Array.from(document.querySelectorAll('input[type=\"text\"], input:not([type])')).filter(isVisible);\n      const input = inputs[inputs.length - 1];\n      if (!input) return { ok: false, reason: 'No input mounted after clicking Edit.' };\n      const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;\n      setter.call(input, ${JSON.stringify(newTitle)});\n      input.dispatchEvent(new Event('input', { bubbles: true }));\n      input.dispatchEvent(new Event('change', { bubbles: true }));\n      input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));\n      return { ok: true };\n    })()`);\n        if (!fillRes?.ok) throw new CommandExecutionError(fillRes?.reason || 'Rename input fill failed', '');\n        await page.wait(1);\n        const verified = await page.evaluate(`(() => {\n      const row = Array.from(document.querySelectorAll('a[href*=\"/chat/' + ${JSON.stringify(id)} + '\"]'))\n        .find((el) => (el.innerText || el.textContent || '').includes(${JSON.stringify(newTitle)}));\n      return !!row;\n    })()`);\n        if (!verified) {\n            throw new CommandExecutionError(\n                `Kimi history rename was not verified for chat ${id}`,\n                'The edit input was submitted, but the history row did not show the requested title.',\n            );\n        }\n        return [{ Status: 'renamed', ChatId: id, NewTitle: newTitle }];\n    },\n});\n","sourceCodeStart":235,"sourceCodeEnd":269,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/kimi/audit-extras.js#L235-L269","documentation":"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').","triggerScenarios":"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>.","commonSituations":"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.","solutions":["Increase the wait between the Edit click and the fill (0.5s is often too short) and retry","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)","Confirm the preceding Edit click actually succeeded (check the earlier error/log) — a failed click means no input will ever appear","Retry the whole command; transient render timing is the most common cause"],"exampleFix":"// before\nawait page.wait(0.5);\nconst fillRes = await page.evaluate(fillInputScript(newTitle));\n// after\nawait page.wait(1.5);\nlet fillRes = await page.evaluate(fillInputScript(newTitle));\nif (!fillRes?.ok) { await page.wait(2); fillRes = await page.evaluate(fillInputScript(newTitle)); }","handlingStrategy":"retry","validationCode":"const hasInput = await page.evaluate(`(() => {\n  const els = Array.from(document.querySelectorAll('input[type=\"text\"], input:not([type])'));\n  return els.length > 0;\n})()`);\nif (!hasInput) throw new Error('No rename input visible — Edit click may have failed or UI changed');","typeGuard":"function isClickResult(res) { return res != null && typeof res === 'object' && typeof res.ok === 'boolean'; }","tryCatchPattern":"try {\n  await runCli('kimi history-edit', { 'chat-id': id, 'new-title': t, yes: true });\n} catch (e) {\n  if (/Rename input fill failed|input/i.test(e.message)) {\n    await sleep(2000);\n    return runCli('kimi history-edit', { 'chat-id': id, 'new-title': t, yes: true });\n  }\n  throw e;\n}","preventionTips":["Lengthen the delay between Edit click and input fill","Confirm the prior Edit click succeeded before filling","Support contenteditable/dialog inputs if Kimi changes the rename UI","Verify the rename landed (the command already checks the row text) and retry on mismatch"],"tags":["browser-automation","dom-selector","ui-change"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}