jackwener/OpenCLI · error · CommandExecutionError

找不到 ${fieldName} 输入框,截图已保存到 /tmp/wechat-channels_publish_${f

Error message

找不到 ${fieldName} 输入框,截图已保存到 /tmp/wechat-channels_publish_${fieldName}_debug.png

What it means

fillField runs an in-page script that traverses shadow DOM to find a field among the given selectors, fills it, and verifies the value. If it cannot find/fill/verify, it saves a debug screenshot to /tmp/wechat-channels_publish_<fieldName>_debug.png and throws CommandExecutionError naming the field. This indicates the form field was not reachable in the current page state.

Source

Thrown at clis/wechat-channels/publish.js:370

        var nativeSetter = Object.getOwnPropertyDescriptor(proto, 'value') && Object.getOwnPropertyDescriptor(proto, 'value').set;
        if (nativeSetter) {
          nativeSetter.call(el, text);
        } else {
          el.value = text;
        }
        el.dispatchEvent(new InputEvent('input', { bubbles: true, data: text, inputType: 'insertText' }));
        el.dispatchEvent(new Event('change', { bubbles: true }));
      }

      var actual = el.isContentEditable ? (el.innerText || el.textContent || '') : (el.value || '');
      el.blur();
      return { ok: actual.indexOf(text) >= 0, sel: foundSel, actual: actual };
    })(${JSON.stringify(selectors)}, ${JSON.stringify(text)})
  `);

  if (!result?.ok) {
    await page.screenshot({ path: `/tmp/wechat-channels_publish_${fieldName}_debug.png` });
    throw new CommandExecutionError(
      `找不到 ${fieldName} 输入框,截图已保存到 /tmp/wechat-channels_publish_${fieldName}_debug.png`
    );
  }
}

// ── Helper: set schedule time ────────────────────────────────────────────────
async function setScheduleTime(page, dt) {
  // Parse target date
  const targetYear  = dt.getFullYear();
  const targetMonth = dt.getMonth() + 1;
  const targetDay   = dt.getDate();
  const targetHour  = dt.getHours();
  const targetMin   = dt.getMinutes();
  const pad = n => String(n).padStart(2, '0');

  // WeChat Channels uses the WeUI desktop date-time picker (class
  // `weui-desktop-picker__date-time`). Its real structure (verified against the
  // live DOM) is NOT a generic calendar:

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect /tmp/wechat-channels_publish_<fieldName>_debug.png to see the actual page state.
  2. Confirm login is valid and the create page rendered fully before the fill step.
  3. Retry — transient slow rendering can miss the field; add/rely on wait before filling.
  4. Update TITLE_SELECTORS / DESC_SELECTORS in clis/wechat-channels/publish.js to match the current DOM from the screenshot.

Example fix

// before
const TITLE_SELECTORS = ['input[placeholder*="短标题"]'];
// after (selector observed in debug screenshot)
const TITLE_SELECTORS = ['input[placeholder*="短标题"]', 'input.weui-desktop-form__input[placeholder*="标题"]'];
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  await publish({ videoPath, title, description });
} catch (e) {
  if (/找不到 .* 输入框/.test(e.message)) {
    const m = e.message.match(/\/tmp\/wechat-channels_publish_(.+)_debug\.png/);
    console.error(`Form field missing (${m?.[1]}); inspect screenshot, check login, retry`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Title (短标题) or description (添加描述) selectors no longer match after a WeChat UI update; the form never rendered because of an expired login or earlier step failure; page still loading when fillField ran.

Common situations: WeChat redesigning the creator form; session redirecting to login; contenteditable structure changed; a prior upload failure leaving the form in a state where fields are absent.

Related errors


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