{"record":{"id":"a3e49210fb0005d6","repo":"jackwener/OpenCLI","slug":"prompt-is-required-a3e492","errorCode":null,"errorMessage":"prompt is required","messagePattern":"prompt is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/qwen/send.js","lineNumber":34,"sourceCode":"    site: 'qwen',\n    name: 'send',\n    access: 'write',\n    description: 'Fire-and-forget: send a prompt to Qianwen without waiting for the reply',\n    domain: QIANWEN_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [\n        { name: 'prompt', required: true, positional: true, help: 'Prompt to send to Qianwen' },\n        { name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },\n        { name: 'think', type: 'boolean', default: false, help: 'Enable 深度思考 (DeepThink)' },\n        { name: 'research', type: 'boolean', default: false, help: 'Enable 深度研究 (DeepResearch)' },\n    ],\n    columns: ['Status', 'Prompt'],\n    func: async (page, kwargs) => {\n        const prompt = String(kwargs.prompt || '').trim();\n        if (!prompt) throw new ArgumentError('prompt is required');\n        const startFresh = normalizeBooleanFlag(kwargs.new, false);\n        const useThink = normalizeBooleanFlag(kwargs.think, false);\n        const useResearch = normalizeBooleanFlag(kwargs.research, false);\n\n        await ensureOnQianwen(page);\n        await dismissLoginModal(page);\n        if (startFresh) {\n            await startNewChat(page);\n            await dismissLoginModal(page);\n        }\n        if (useThink) await setFeatureToggle(page, 'think', true);\n        if (useResearch) await setFeatureToggle(page, 'research', true);\n\n        const send = await sendMessage(page, prompt);\n        if (!send?.ok) {\n            if (await hasLoginGate(page)) throw authRequired();\n            throw new CommandExecutionError(send?.reason || 'Failed to send Qianwen prompt');\n        }","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qwen/send.js#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nMSG=\"\"\nclis qwen send --prompt \"$MSG\"\n// after\nMSG=\"Explain HTTP caching\"\n[ -n \"$MSG\" ] && clis qwen send --prompt \"$MSG\"","handlingStrategy":"validation","validationCode":"const prompt = (process.argv.prompt || '').trim();\nif (!prompt) {\n  throw new Error('qwen send requires a non-empty --prompt, e.g. --prompt \"Explain HTTP caching\"');\n}","typeGuard":"const hasPrompt = (kwargs) => typeof kwargs?.prompt === 'string' && kwargs.prompt.trim().length > 0;","tryCatchPattern":"try {\n  await runQianwenSend(args);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message === 'prompt is required') {\n    console.error('Usage: qwen send --prompt \"<text>\"');\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["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"],"tags":["validation","arguments","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}