jackwener/OpenCLI · error · ArgumentError
prompt is required
Error message
prompt is required
What it means
clis/qwen/send.js trims kwargs.prompt and throws ArgumentError('prompt is required') when the result is empty. The command exists to send a text prompt to the Qianwen chat, so a missing/blank prompt is rejected before any browser interaction.
Source
Thrown at clis/qwen/send.js:34
site: 'qwen',
name: 'send',
access: 'write',
description: 'Fire-and-forget: send a prompt to Qianwen without waiting for the reply',
domain: QIANWEN_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
navigateBefore: false,
args: [
{ name: 'prompt', required: true, positional: true, help: 'Prompt to send to Qianwen' },
{ name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },
{ name: 'think', type: 'boolean', default: false, help: 'Enable 深度思考 (DeepThink)' },
{ name: 'research', type: 'boolean', default: false, help: 'Enable 深度研究 (DeepResearch)' },
],
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);
const useThink = normalizeBooleanFlag(kwargs.think, false);
const useResearch = normalizeBooleanFlag(kwargs.research, false);
await ensureOnQianwen(page);
await dismissLoginModal(page);
if (startFresh) {
await startNewChat(page);
await dismissLoginModal(page);
}
if (useThink) await setFeatureToggle(page, 'think', true);
if (useResearch) await setFeatureToggle(page, 'research', true);
const send = await sendMessage(page, prompt);
if (!send?.ok) {
if (await hasLoginGate(page)) throw authRequired();
throw new CommandExecutionError(send?.reason || 'Failed to send Qianwen prompt');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Pass --prompt with non-empty text, e.g. --prompt 'Explain HTTP caching'
- Quote multi-word prompts so the shell delivers one argument
- Echo/verify the variable feeding --prompt is non-empty in your script
- If passing positionally, switch to the explicit --prompt flag
Example fix
// before MSG="" clis qwen send --prompt "$MSG" // after MSG="Explain HTTP caching" [ -n "$MSG" ] && clis qwen send --prompt "$MSG"
Defensive patterns
Strategy: validation
Validate before calling
const prompt = (process.argv.prompt || '').trim();
if (!prompt) {
throw new Error('qwen send requires a non-empty --prompt, e.g. --prompt "Explain HTTP caching"');
} Type guard
const hasPrompt = (kwargs) => typeof kwargs?.prompt === 'string' && kwargs.prompt.trim().length > 0;
Try / catch
try {
await runQianwenSend(args);
} catch (e) {
if (e instanceof ArgumentError && e.message === 'prompt is required') {
console.error('Usage: qwen send --prompt "<text>"');
process.exitCode = 2;
} else throw e;
} Prevention
- Always pass --prompt explicitly; do not rely on positional arguments
- Quote prompts, especially multi-word or multi-line ones
- Guard shell variables: [ -n "$PROMPT" ] before invoking
- Trim user-supplied prompts in wrapper scripts before forwarding
When it happens
Trigger: Invoking the send command without --prompt; passing --prompt '' or only whitespace (' '); passing the message positionally when the CLI only reads kwargs.prompt; an enclosing script drops the argument due to quoting issues.
Common situations: Shell quoting bugs where an empty variable expands to nothing (prompt="$MSG" with MSG empty); forgetting the flag name; multi-line prompts mangled by the shell; wrapper scripts that filter out empty args.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- INVALID_ARGUMENT
- INVALID_ARGUMENT
- ${label} is required
- ${label} must be a positive integer
- ${label} must be <= ${maxValue}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a3e49210fb0005d6.
Report an issue: GitHub.