jackwener/OpenCLI · error · CommandExecutionError

抖音作品 ${awemeId} 未在作品列表中找到,未执行删除

Error message

抖音作品 ${awemeId} 未在作品列表中找到,未执行删除

What it means

Thrown in the delete flow's before-check: after the UI-manage delete attempt failed (fallbackError) and/or before issuing the aweme/delete API call, the library looks the aweme_id up in the work list and throws if it is absent. If the work is not in the list, the library refuses to POST the delete API because the target was never confirmed to exist under this account.

Source

Thrown at clis/douyin/delete.js:138

    args: [
        { name: 'aweme_id', required: true, positional: true, help: '作品 ID / item_id' },
    ],
    columns: ['status'],
    func: async (page, kwargs) => {
        const awemeId = readAwemeId(kwargs.aweme_id);
        try {
            const deleted = await deleteViaCreatorManage(page, awemeId);
            return [{ status: `✅ 已通过后台管理删除 ${deleted.aweme_id || awemeId}` }];
        } catch (fallbackError) {
            const fallbackMessage = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);
            if (!fallbackMessage.includes('"reason":"not_found"')) {
                throw fallbackError;
            }
        }

        const before = await findWorkListItem(page, awemeId);
        if (!before) {
            throw new CommandExecutionError(`抖音作品 ${awemeId} 未在作品列表中找到,未执行删除`);
        }
        const url = 'https://creator.douyin.com/web/api/media/aweme/delete/?aid=1128';
        await browserFetch(page, 'POST', url, { body: { aweme_id: awemeId }, timeoutMs: 8000 });
        const deadline = Date.now() + 10_000;
        while (Date.now() < deadline) {
            await sleep(500);
            const after = await findWorkListItem(page, awemeId);
            if (!after) {
                return [{ status: `✅ 已删除 ${awemeId}` }];
            }
        }
        throw new CommandExecutionError(`抖音作品 ${awemeId} 删除后仍在作品列表中,删除未确认`);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the id is an aweme_id of a published work on this account (check creator-micro content manage page)
  2. Confirm the work's status — drafts/hidden works may need a different status param in WORK_LIST_URL
  3. Log the returned list length and ids to confirm the work really is missing vs filtered out
  4. If already deleted, treat the command as a no-op rather than an error

Example fix

// before
const before = await findWorkListItem(page, awemeId);
if (!before) throw new CommandExecutionError(`not found`);
// after
const before = await findWorkListItem(page, awemeId);
if (!before) return [{ status: `ℹ️ ${awemeId} 不在列表中(可能已删除)` }];
Defensive patterns

Strategy: validation

Validate before calling

const list = extractWorkList(await browserFetch(page, 'GET', workListUrl));
const exists = list.some(e => String(e.aweme_id) === String(awemeId) || String(e.item_id) === String(awemeId));
if (!exists) console.warn(`${awemeId} not found — it may already be deleted or belong to another account`);

Type guard

function workExistsInList(list, awemeId) {
  return Array.isArray(list) && list.some(e => String(e.aweme_id ?? e.item_id ?? '') === String(awemeId));
}

Try / catch

try {
  await deleteCommand(page, awemeId);
} catch (e) {
  if (new RegExp(`抖音作品 ${awemeId} 未在作品列表`).test(e.message)) {
    return [{ status: `ℹ️ ${awemeId} already absent from work list (likely already deleted)` }];
  } throw e;
}

Prevention

When it happens

Trigger: The aweme_id belongs to a different account or a non-creator-managed work; the work was already deleted; the work list returned fewer than all items (pagination, status filter status=0 excludes some states); session problem causing findWorkListItem to return null after list shape errors were avoided.

Common situations: Deleting via `douyin delete <id>` for a video posted from another account; draft or under-review videos not present in the status=0 list; id typo'd so it matches no entry.

Related errors


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