jackwener/OpenCLI · warning · ArgumentError
text is required
Error message
text is required
What it means
An ArgumentError thrown by the qoder send command's argument validation. Even though the positional 'text' arg is declared required, the command re-validates: it coerces kwargs.text to a string, trims it, and throws if the result is empty. This guards against whitespace-only or empty input reaching the composer automation.
Source
Thrown at clis/qoder/quest.js:63
},
});
// -------- send --------
cli({
site: 'qoder',
name: 'send',
access: 'write',
description: 'Type text into the Qoder composer and click "Send message" (fire-and-forget).',
domain: 'localhost',
strategy: Strategy.UI,
browser: true,
args: [
{ name: 'text', positional: true, required: true, help: 'Text to send' },
],
columns: ['Status', 'Length'],
func: async (page, kwargs) => {
const text = String(kwargs?.text || '').trim();
if (!text) throw new ArgumentError('text is required');
const beforeCount = await evaluateQoder(page, QODER_MESSAGE_COUNT_JS);
const typeRes = await evaluateQoder(page, buildQoderInjectTextScript(text));
if (!typeRes?.ok) throw new CommandExecutionError(typeRes?.reason || 'composer type failed', '');
await page.wait(0.3);
// Click Send message
const sendRes = await evaluateQoder(page, clickFirstScript([
'button[aria-label="Send message"]',
'button[title="Send message"]',
]));
if (!sendRes?.ok) {
// Fallback: try clickByText.
const textRes = await evaluateQoder(page, clickByTextScript(['Send message', 'Send', '发送']));
if (!textRes?.ok) throw new CommandExecutionError('Send button not found', '');
}
const afterCount = await waitForMessageCountGrowth(page, beforeCount);
if (Number(afterCount) <= Number(beforeCount)) {View on GitHub (pinned to 49907e53dc)
Solutions
- Pass non-empty prompt text as the positional argument: `qoder send "Fix the failing test in auth.js"`.
- Trim-check the input in your shell script before calling: `[ -n "${TEXT// }" ] || exit 1`.
- If using variables, quote them ("$TEXT") and verify they are set (`: "${TEXT:?TEXT is unset}"`) before invoking send.
- Use the `ask` command instead if you also need the reply — it has the same text requirement but waits for a response.
Example fix
// before
const text = String(kwargs?.text || '').trim();
if (!text) throw new ArgumentError('text is required');
// after (caller side, shell)
// qoder send "$PROMPT" # quoted, non-empty PROMPT verified with :? above Defensive patterns
Strategy: validation
Validate before calling
# Shell: fail fast before invoking qoder send
: "${PROMPT:?PROMPT is unset or empty}"
PROMPT_TRIMMED=$(echo "$PROMPT" | tr -d '[:space:]')
[ -n "$PROMPT_TRIMMED" ] || { echo 'text is required'; exit 1; }
qoder send "$PROMPT" Type guard
function isNonEmptyText(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await runCli('qoder send', [text]);
} catch (e) {
if (String(e.message) === 'text is required') {
throw new Error('Caller bug: prompt text was empty/whitespace — check variable expansion');
}
throw e;
} Prevention
- Quote positional args in shell ("$TEXT") so empty expansion doesn't drop the arg.
- Trim and assert prompt text before every send call in scripts.
- Use :? parameter expansion to fail fast on unset variables.
- Remember both send and ask require a non-empty positional text.
When it happens
Trigger: Running `qoder send` with: no positional argument at all; an argument that is only whitespace (e.g. `qoder send " "`); an empty shell-expanded variable (`qoder send "$EMPTY"`); or a caller passing text under a different kwarg name so kwargs.text is undefined.
Common situations: Shell scripts quoting text incorrectly so the positional is dropped; variables that expand to empty because a previous command failed; CI pipelines passing env vars that are unset; users forgetting the positional because other commands take only flags.
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
- ${label} must be a non-negative integer, got ${JSON.stringif
- limit must be a positive integer
- bilibili comment ${label} must be a positive integer
- bilibili comment message cannot be empty
- bilibili unfollow target cannot be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f51beaaab8ab767f.
Report an issue: GitHub.