jackwener/OpenCLI · error · ArgumentError

douyin delete aweme_id cannot be empty

Error message

douyin delete aweme_id cannot be empty

What it means

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.

Source

Thrown at clis/douyin/delete.js:12

import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';
import { browserFetch } from './_shared/browser-fetch.js';
import { requireObjectEvaluateResult } from './_shared/evaluate-result.js';

const CREATOR_MANAGE_URL = 'https://creator.douyin.com/creator-micro/content/manage';
const WORK_LIST_URL = '/janus/douyin/creator/pc/work_list?status=0&count=20&max_cursor=0&scene=star_atlas&device_platform=android&aid=1128';

function readAwemeId(raw) {
    const value = String(raw ?? '').trim();
    if (!value) {
        throw new ArgumentError('douyin delete aweme_id cannot be empty');
    }
    if (!/^\d+$/.test(value)) {
        throw new ArgumentError('douyin delete aweme_id must be a numeric id');
    }
    return value;
}

function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
}

async function deleteViaCreatorManage(page, workId) {
    await page.goto(CREATOR_MANAGE_URL);
    await sleep(3000);
    await sleep(3000);
    const result = requireObjectEvaluateResult(await page.evaluate(`
    (async () => {
      const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a numeric aweme_id explicitly: `douyin delete <id>`
  2. Echo the shell variable before running to confirm it is non-empty
  3. Look up the id via the work list command if unknown

Example fix

// before
cli delete "$AWEME_ID"   // AWEME_ID unset
// after
: "${AWEME_ID:?aweme_id is required}"
cli delete "$AWEME_ID"
Defensive patterns

Strategy: validation

Validate before calling

function assertAwemeId(raw) {
  const v = String(raw ?? '').trim();
  if (!v) throw new Error('aweme_id is required');
  return v;
}

Type guard

function isNonEmptyId(raw) {
  return typeof raw === 'string' && raw.trim().length > 0;
}

Try / catch

try {
  await cli.delete(awemeId);
} catch (e) {
  if (/aweme_id cannot be empty/.test(e.message)) {
    console.error('Provide a numeric aweme_id, e.g. `douyin delete 7301234567890`');
  } else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: CI pipelines where the id is interpolated from a previous step's output that was empty; copy-paste mistakes; forgetting the positional argument.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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