{"record":{"id":"165fedf8258e66a3","repo":"jackwener/OpenCLI","slug":"awemeid","errorCode":null,"errorMessage":"抖音作品 ${awemeId} 未在作品列表中找到，未执行删除","messagePattern":"抖音作品 (.+?) 未在作品列表中找到，未执行删除","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/douyin/delete.js","lineNumber":138,"sourceCode":"    args: [\n        { name: 'aweme_id', required: true, positional: true, help: '作品 ID / item_id' },\n    ],\n    columns: ['status'],\n    func: async (page, kwargs) => {\n        const awemeId = readAwemeId(kwargs.aweme_id);\n        try {\n            const deleted = await deleteViaCreatorManage(page, awemeId);\n            return [{ status: `✅ 已通过后台管理删除 ${deleted.aweme_id || awemeId}` }];\n        } catch (fallbackError) {\n            const fallbackMessage = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);\n            if (!fallbackMessage.includes('\"reason\":\"not_found\"')) {\n                throw fallbackError;\n            }\n        }\n\n        const before = await findWorkListItem(page, awemeId);\n        if (!before) {\n            throw new CommandExecutionError(`抖音作品 ${awemeId} 未在作品列表中找到，未执行删除`);\n        }\n        const url = 'https://creator.douyin.com/web/api/media/aweme/delete/?aid=1128';\n        await browserFetch(page, 'POST', url, { body: { aweme_id: awemeId }, timeoutMs: 8000 });\n        const deadline = Date.now() + 10_000;\n        while (Date.now() < deadline) {\n            await sleep(500);\n            const after = await findWorkListItem(page, awemeId);\n            if (!after) {\n                return [{ status: `✅ 已删除 ${awemeId}` }];\n            }\n        }\n        throw new CommandExecutionError(`抖音作品 ${awemeId} 删除后仍在作品列表中，删除未确认`);\n    },\n});\n","sourceCodeStart":120,"sourceCodeEnd":153,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/douyin/delete.js#L120-L153","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the id is an aweme_id of a published work on this account (check creator-micro content manage page)","Confirm the work's status — drafts/hidden works may need a different status param in WORK_LIST_URL","Log the returned list length and ids to confirm the work really is missing vs filtered out","If already deleted, treat the command as a no-op rather than an error"],"exampleFix":"// before\nconst before = await findWorkListItem(page, awemeId);\nif (!before) throw new CommandExecutionError(`not found`);\n// after\nconst before = await findWorkListItem(page, awemeId);\nif (!before) return [{ status: `ℹ️ ${awemeId} 不在列表中（可能已删除）` }];","handlingStrategy":"validation","validationCode":"const list = extractWorkList(await browserFetch(page, 'GET', workListUrl));\nconst exists = list.some(e => String(e.aweme_id) === String(awemeId) || String(e.item_id) === String(awemeId));\nif (!exists) console.warn(`${awemeId} not found — it may already be deleted or belong to another account`);","typeGuard":"function workExistsInList(list, awemeId) {\n  return Array.isArray(list) && list.some(e => String(e.aweme_id ?? e.item_id ?? '') === String(awemeId));\n}","tryCatchPattern":"try {\n  await deleteCommand(page, awemeId);\n} catch (e) {\n  if (new RegExp(`抖音作品 ${awemeId} 未在作品列表`).test(e.message)) {\n    return [{ status: `ℹ️ ${awemeId} already absent from work list (likely already deleted)` }];\n  } throw e;\n}","preventionTips":["Confirm the aweme_id belongs to the logged-in account before deleting","Account for status filters (status=0) that exclude drafts/hidden works","Treat 'not found' as idempotent success if the goal is deletion","Verify the id source (work list vs share URL) when errors repeat"],"tags":["douyin","delete","not-found","api-error"],"backgroundTag":"resource-not-found-before-delete","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}