jackwener/OpenCLI · error · ArgumentError
必须提供 --reschedule 或 --caption
Error message
必须提供 --reschedule 或 --caption
What it means
An ArgumentError thrown by the douyin update command when neither --reschedule nor --caption is provided. The command performs exactly one of: rescheduling the publish time via the media/update/timer API, or rewriting the caption text. With no operation specified there is nothing to do, so the library fails fast instead of issuing a no-op request.
Source
Thrown at clis/douyin/update.js:20
import { ArgumentError } from '@jackwener/opencli/errors';
import { browserFetch } from './_shared/browser-fetch.js';
import { toUnixSeconds, validateTiming } from './_shared/timing.js';
cli({
site: 'douyin',
name: 'update',
access: 'write',
description: '更新视频信息',
domain: 'creator.douyin.com',
strategy: Strategy.COOKIE,
args: [
{ name: 'aweme_id', required: true, positional: true, help: '抖音作品 ID(aweme_id,可从作品 URL 末尾获取)' },
{ name: 'reschedule', default: '', help: '新的发布时间(ISO8601 或 Unix 秒)' },
{ name: 'caption', default: '', help: '新的正文内容' },
],
columns: ['status'],
func: async (page, kwargs) => {
if (!kwargs.reschedule && !kwargs.caption) {
throw new ArgumentError('必须提供 --reschedule 或 --caption');
}
if (kwargs.reschedule) {
const newTime = toUnixSeconds(kwargs.reschedule);
validateTiming(newTime);
await browserFetch(page, 'POST', 'https://creator.douyin.com/web/api/media/update/timer/?aid=1128', { body: { aweme_id: kwargs.aweme_id, publish_time: newTime } });
}
if (kwargs.caption) {
await browserFetch(page, 'POST', 'https://creator.douyin.com/web/api/media/update/desc/?aid=1128', { body: { aweme_id: kwargs.aweme_id, desc: kwargs.caption } });
}
return [{ status: '✅ 更新成功' }];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Pass --caption with the new body text, e.g. `douyin update --aweme-id <id> --caption "new text"`.
- Pass --reschedule with an ISO8601 timestamp or Unix seconds, e.g. `--reschedule "2026-09-01T10:00:00+08:00"`.
- In scripts, only invoke the update command when at least one of the two values is non-empty.
Example fix
// before await run(['douyin', 'update', '--aweme-id', id]); // after await run(['douyin', 'update', '--aweme-id', id, '--caption', newCaption]);
Defensive patterns
Strategy: validation
Validate before calling
if (!reschedule && !caption) {
throw new Error('douyin update requires --reschedule or --caption');
} Try / catch
try {
await run('douyin update', { aweme_id: id, caption, reschedule });
} catch (e) {
if (e.name === 'ArgumentError') {
console.error('Provide --reschedule or --caption');
process.exitCode = 2;
return;
}
throw e;
} Prevention
- In wrappers, drop empty-string flags but assert at least one operation value is present before invoking.
- Validate caption is a non-empty string and reschedule parses as ISO8601/Unix seconds before calling.
- Never call update with aweme_id alone — it performs nothing by design.
When it happens
Trigger: Calling `douyin update --aweme-id <id>` with no --reschedule and no --caption flag (or with both flags present but empty strings, which is their default '').
Common situations: Scripted invocations that build the argument list dynamically and drop empty flags; calling the command just to 'touch' a work; forgetting that aweme_id alone does not imply any action.
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
- douyin user-videos requires a sec_uid
- <train-no> must not be empty
- symbol is required
- bilibili comments --top cannot be combined with --parent (pi
- <username> is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/89f64883ca23369d.
Report an issue: GitHub.