jackwener/OpenCLI · error · ArgumentError

prompt

Error message

prompt

What it means

The yuanbao send command requires a positional `prompt` argument. The handler trims the stringified value and throws ArgumentError('prompt','is required') when nothing usable remains. The terse message 'prompt' is the bare argument name surfaced by the CLI argument-error formatter.

Source

Thrown at clis/yuanbao/send.js:30

cli({
    site: 'yuanbao',
    name: 'send',
    access: 'write',
    description: 'Fire-and-forget: send a prompt to Yuanbao without waiting for the reply',
    domain: YUANBAO_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'prompt', positional: true, required: true, help: 'Prompt to send to Yuanbao' },
        { name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },
    ],
    columns: ['Status', 'Prompt'],
    func: async (page, kwargs) => {
        const prompt = String(kwargs.prompt || '').trim();
        if (!prompt) throw new ArgumentError('prompt', 'is required');
        const startFresh = normalizeBooleanFlag(kwargs.new, false);

        await ensureYuanbaoPage(page);
        if (await hasLoginGate(page)) {
            throw authRequired('Yuanbao opened a login gate before sending the prompt.');
        }
        if (startFresh) {
            const action = await startNewYuanbaoChat(page);
            if (action === 'blocked') {
                throw authRequired('Yuanbao opened a login gate while starting a new chat.');
            }
        }
        const send = await sendYuanbaoMessage(page, prompt);
        if (!send?.ok) {
            if (await hasLoginGate(page)) {
                throw authRequired('Yuanbao opened a login gate instead of accepting the prompt.');
            }
            throw new CommandExecutionError(

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass the prompt as a quoted positional: `yuanbao send "Summarize this article"`
  2. Check the calling script for an empty PROMPT variable before invoking
  3. If the prompt may contain newlines/special chars, single-quote it or write it to a file and use $(cat file) carefully

Example fix

// before
yuanbao send
// after
yuanbao send "Explain event loop in JS"
Defensive patterns

Strategy: validation

Validate before calling

if (typeof prompt !== 'string' || !prompt.trim()) {
  throw new Error('prompt is required and must be non-empty');
}

Type guard

const hasPrompt = (v) => typeof v === 'string' && v.trim().length > 0;

Try / catch

try {
  await cli.yuanbaoSend(prompt);
} catch (e) {
  if (e.name === 'ArgumentError' && e.param === 'prompt') {
    console.error('Usage: yuanbao send "<prompt>"');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `yuanbao send` with no positional argument, or passing only whitespace (e.g. `yuanbao send " "`), so String(kwargs.prompt||'').trim() yields ''.

Common situations: Scripted calls where the prompt variable is empty/unset; shell quoting bugs that drop the argument; piping intended to supply stdin when the command only reads argv.

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/aba435bdc640e980. Report an issue: GitHub.