jackwener/OpenCLI · error · CommandExecutionError

未检测到抖音草稿恢复提示

Error message

未检测到抖音草稿恢复提示

What it means

waitForDraftResult polls for up to 20 seconds after saving, waiting for the page to be on '/creator-micro/content/upload' with body text matching /继续编辑/ (the resumable-draft prompt). If that confirmation never appears it throws this CommandExecutionError with the last page URL as detail. The save click may have failed silently or the post-save UI copy changed.

Source

Thrown at clis/douyin/draft.js:288

    };
}
/**
 * Wait until creator center shows the resumable-draft prompt after saving.
 */
async function waitForDraftResult(page, creationId) {
    let lastState = { href: '', bodyText: '' };
    for (let attempt = 0; attempt < 20; attempt += 1) {
        lastState = (await page.evaluate(`() => ({
      href: location.href,
      bodyText: document.body?.innerText || ''
    })`));
        if (lastState.href.includes('/creator-micro/content/upload')
            && /继续编辑/.test(lastState.bodyText)) {
            return creationId;
        }
        await page.wait({ time: 1 });
    }
    throw new CommandExecutionError('未检测到抖音草稿恢复提示', `当前页面: ${lastState.href || 'unknown'}`);
}
cli({
    site: 'douyin',
    name: 'draft',
    access: 'write',
    description: '上传视频并保存为草稿',
    domain: 'creator.douyin.com',
    strategy: Strategy.COOKIE,
    navigateBefore: false,
    args: [
        { name: 'video', required: true, positional: true, help: '视频文件路径' },
        { name: 'title', required: true, help: '视频标题(≤30字)' },
        { name: 'caption', default: '', help: '正文内容(≤1000字,支持 #话题)' },
        { name: 'cover', default: '', help: '封面图片路径' },
        { name: 'visibility', default: 'public', choices: ['public', 'friends', 'private'] },
    ],
    columns: ['status', 'draft_id'],
    func: async (page, kwargs) => {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check the detail URL — if still on the composer, the click likely didn't take effect; retry the whole draft command
  2. Look for and dismiss any confirmation modal after clicking save (extend dismissKnownModals targets)
  3. Manually verify in creator center whether the draft was actually saved despite the missing prompt; if saved, only detection is broken — update the /继续编辑/ regex in clis/douyin/draft.js:283
  4. Increase the 20s/20-attempt budget if drafts save slowly on your network

Example fix

// before
if (lastState.href.includes('/creator-micro/content/upload')
    && /继续编辑/.test(lastState.bodyText)) {
// after: also accept landing on draft list
if (/creator-micro\/content/.test(lastState.href)
    && /继续编辑|草稿/.test(lastState.bodyText)) {
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await opencli.douyin.draft({ video, title });
} catch (e) {
  if (e.message.includes('未检测到抖音草稿恢复提示')) {
    // check creator center manually — the draft may exist; detection regex may be stale
  }
}

Prevention

When it happens

Trigger: After clicking '暂存离开': a confirmation dialog blocks navigation, the draft-save request fails server-side, the page navigates elsewhere (e.g. content list instead of upload page), or the '继续编辑' copy was changed/removed by Douyin.

Common situations: Douyin save flow showing an extra confirm modal ('确定暂存?'); slow draft-save API leaving the page in the old state past 20s; UI update rewording the recovery prompt; account risk-control rejecting the save.

Related errors


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