jackwener/OpenCLI · error · CommandExecutionError

视频上传/转码超时(${Math.ceil(maxMs / 1000)}秒),请检查网络或稍后重试

Error message

视频上传/转码超时(${Math.ceil(maxMs / 1000)}秒),请检查网络或稍后重试

What it means

waitForUploadDone polls every 3 seconds up to maxMs (default 180s, bounded by the --timeout deadline); if the upload/transcode never completes in that window it throws CommandExecutionError with the elapsed seconds and asks the user to check the network or retry. Unlike 4407, the page never reported failure — it simply never reported done.

Source

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

      // Wait and retry rather than aborting.
      const msg = err instanceof Error ? err.message : String(err);
      if (msg.includes('ECONNRESET') || msg.includes('fetch failed')) {
        process.stderr.write(`  [retry] bridge reconnecting after page re-render (${i + 1}/${maxAttempts})...\n`);
        await page.wait({ time: pollMs / 1000 });
        continue;
      }
      throw err;
    }

    if (done?.failed) {
      throw new CommandExecutionError('视频上传失败,请检查文件格式和网络连接');
    }
    if (done?.done) return;

    await page.wait({ time: pollMs / 1000 });
  }

  throw new CommandExecutionError(`视频上传/转码超时(${Math.ceil(maxMs / 1000)}秒),请检查网络或稍后重试`);
}

// ── Helper: fill text field (with shadow DOM traversal) ─────────────────────
async function fillField(page, selectors, text, fieldName) {
  const result = await evalPage(page, `
    (function(selectors, text) {
      ${DEEP_QUERY_FN}

      var el = null;
      var foundSel = null;
      for (var i = 0; i < selectors.length; i++) {
        var candidate = deepQuery(selectors[i]);
        if (candidate && isVisible(candidate)) {
          el = candidate;
          foundSel = selectors[i];
          break;
        }
      }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a longer window — increase --timeout so the wait budget grows.
  2. Upload a smaller or lower-bitrate video.
  3. Verify network stability, then retry.
  4. If the file actually uploaded (visible on the page), the status selectors in waitForUploadDone may need updating for a WeChat DOM change.

Example fix

// before
node publish.js --video 4k-master.mp4 --timeout 120
// after
node publish.js --video 4k-master.mp4 --timeout 1800
Defensive patterns

Strategy: retry

Validate before calling

const mb = require('fs').statSync(videoPath).size / 1048576;
if (mb > 500 && timeoutSeconds < 1800) {
  console.warn(`Large file (${mb.toFixed(0)}MB); consider --timeout >= 1800`);
}

Type guard

null

Try / catch

try {
  await publish({ videoPath, timeout });
} catch (e) {
  if (/视频上传\/转码超时/.test(e.message)) {
    return publish({ videoPath, timeout: Math.max(timeout * 2, 1800) });
  }
  throw e;
}

Prevention

When it happens

Trigger: Upload throughput too low for the file size within maxMs; transcode stuck server-side; page status element changed so the completion check never matches; extremely large 4K files.

Common situations: Slow or throttled uplinks; WeChat-side transcode queues busy; WeChat DOM change breaking status detection so 'done' is never observed even though upload finished.

Related errors


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