{"record":{"id":"536e9dba7238d6f9","repo":"jackwener/OpenCLI","slug":"douyin-delete-aweme-id-cannot-be-empty","errorCode":null,"errorMessage":"douyin delete aweme_id cannot be empty","messagePattern":"douyin delete aweme_id cannot be empty","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/douyin/delete.js","lineNumber":12,"sourceCode":"import { cli, Strategy } from '@jackwener/opencli/registry';\nimport { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';\nimport { browserFetch } from './_shared/browser-fetch.js';\nimport { requireObjectEvaluateResult } from './_shared/evaluate-result.js';\n\nconst CREATOR_MANAGE_URL = 'https://creator.douyin.com/creator-micro/content/manage';\nconst WORK_LIST_URL = '/janus/douyin/creator/pc/work_list?status=0&count=20&max_cursor=0&scene=star_atlas&device_platform=android&aid=1128';\n\nfunction readAwemeId(raw) {\n    const value = String(raw ?? '').trim();\n    if (!value) {\n        throw new ArgumentError('douyin delete aweme_id cannot be empty');\n    }\n    if (!/^\\d+$/.test(value)) {\n        throw new ArgumentError('douyin delete aweme_id must be a numeric id');\n    }\n    return value;\n}\n\nfunction sleep(ms) {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function deleteViaCreatorManage(page, workId) {\n    await page.goto(CREATOR_MANAGE_URL);\n    await sleep(3000);\n    await sleep(3000);\n    const result = requireObjectEvaluateResult(await page.evaluate(`\n    (async () => {\n      const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/douyin/delete.js#L1-L30","documentation":"Thrown by readAwemeId (called by the awemeId CLI argument parser) when the aweme_id argument is empty or whitespace-only. The library requires a concrete numeric Douyin work id to locate and delete the video. Thrown as an ArgumentError to indicate invalid user input rather than a runtime failure.","triggerScenarios":"Running `douyin delete` with no aweme_id argument; passing an empty string or only spaces; a shell variable that resolved to empty (e.g. $AWEME_ID unset).","commonSituations":"CI pipelines where the id is interpolated from a previous step's output that was empty; copy-paste mistakes; forgetting the positional argument.","solutions":["Pass a numeric aweme_id explicitly: `douyin delete <id>`","Echo the shell variable before running to confirm it is non-empty","Look up the id via the work list command if unknown"],"exampleFix":"// before\ncli delete \"$AWEME_ID\"   // AWEME_ID unset\n// after\n: \"${AWEME_ID:?aweme_id is required}\"\ncli delete \"$AWEME_ID\"","handlingStrategy":"validation","validationCode":"function assertAwemeId(raw) {\n  const v = String(raw ?? '').trim();\n  if (!v) throw new Error('aweme_id is required');\n  return v;\n}","typeGuard":"function isNonEmptyId(raw) {\n  return typeof raw === 'string' && raw.trim().length > 0;\n}","tryCatchPattern":"try {\n  await cli.delete(awemeId);\n} catch (e) {\n  if (/aweme_id cannot be empty/.test(e.message)) {\n    console.error('Provide a numeric aweme_id, e.g. `douyin delete 7301234567890`');\n  } else throw e;\n}","preventionTips":["Always pass the id as a positional argument; never rely on possibly-unset env vars","Use ${VAR:?msg} shell guards in scripts/CI","Look the id up from the work list command when unknown"],"tags":["douyin","argument","validation","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}