jackwener/OpenCLI · error · CommandExecutionError
${label}超时,请增加 --timeout 后重试
Error message
${label}超时,请增加 --timeout 后重试 What it means
remainingMs computes time left before the overall publish deadline; when the deadline has passed it throws CommandExecutionError telling the user to raise --timeout and retry. This is the guard ensuring no automation step continues after the user-specified time budget is exhausted.
Source
Thrown at clis/wechat-channels/publish.js:111
? new Date(raw < 1e12 ? raw * 1000 : raw)
: new Date(String(raw));
if (Number.isNaN(dt.getTime())) {
throw new ArgumentError(`无法解析定时时间: ${raw}`);
}
if (dt.getTime() <= Date.now()) {
throw new ArgumentError('定时时间必须晚于当前时间');
}
return dt;
}
function parseBooleanFlag(raw) {
return raw === true || raw === 'true' || raw === '1' || raw === 1;
}
function remainingMs(deadline, label) {
const left = deadline - Date.now();
if (left <= 0) {
throw new CommandExecutionError(`${label}超时,请增加 --timeout 后重试`);
}
return left;
}
function submitSucceeded({ isDraft, finalUrl, successMsg }) {
const msg = String(successMsg || '');
if (isDraft) {
return /草稿已保存|暂存成功|保存成功/.test(msg);
}
if (/已发表|发布成功|发表成功|审核中/.test(msg)) {
return true;
}
const url = String(finalUrl || '');
return /\/platform\/post\/list\b/.test(url);
}
export const __test__ = {
parseTimeoutSeconds,View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run with a larger --timeout, e.g. --timeout 1800.
- Upload a smaller/lower-bitrate video to shorten upload and transcode time.
- Check network throughput; retry when the connection is stable.
Example fix
// before node publish.js --video big-4k.mp4 --timeout 60 // after node publish.js --video big-4k.mp4 --timeout 1800
Defensive patterns
Strategy: retry
Validate before calling
const fileSize = require('fs').statSync(videoPath).size;
const estSeconds = (fileSize / (5 * 1024 * 1024)) * 2; // ~5 Mbps up, 2x safety
if (estSeconds > timeoutSeconds) {
throw new Error(`--timeout ${timeoutSeconds}s likely too small for ${fileSize} bytes`);
} Type guard
null
Try / catch
try {
await publish({ videoPath, timeout });
} catch (e) {
if (/超时,请增加 --timeout/.test(e.message)) {
return publish({ videoPath, timeout: timeout * 2 });
}
throw e;
} Prevention
- Size --timeout to your upload bandwidth and file size, with 2-3x headroom.
- Prefer stable wired connections for large uploads.
- Compress videos before publishing to shorten the flow.
When it happens
Trigger: The total publish flow (navigation, upload, transcode, form filling) exceeds the --timeout value; the deadline elapses while waiting between steps and the next remainingMs call finds left <= 0.
Common situations: Large video files on slow uplinks; WeChat transcode taking longer than usual; setting --timeout 60 for a multi-minute upload.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Failed to fetch Xiaoyuzhou transcript content: ${getErrorMes
- yuanbao ask
- FETCH_ERROR
- archive search request failed: ${error?.message || error}
- archive search returned malformed JSON: ${error?.message ||
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/26c0bff816af4ecd.
Report an issue: GitHub.