jackwener/OpenCLI · warning · CliError
INVALID_ARGUMENT
INVALID_ARGUMENT
Error message
At least one symbol is required
What it means
quote.js splits the --symbols argument with splitSymbols() (splitting on commas, Chinese commas, and whitespace) and throws this CliError INVALID_ARGUMENT if nothing remains. The quote command requires at least one stock symbol to build the secid list for the ulist.np request.
Source
Thrown at clis/eastmoney/quote.js:64
name: 'quote',
access: 'read',
description: '个股实时行情(A股 / 港股 / 美股)— 来自 push2.eastmoney.com',
domain: 'push2.eastmoney.com',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'symbols', required: true, positional: true, help: '股票代码(可用逗号/空格分隔多个)' },
],
columns: [
'code', 'name', 'market', 'price', 'changePercent', 'change',
'open', 'high', 'low', 'prevClose', 'volume', 'turnover',
'turnoverRate', 'amplitude', 'peDynamic', 'priceBook',
'marketCap', 'floatMarketCap',
],
func: async (args) => {
const raw = splitSymbols(args.symbols);
if (raw.length === 0) {
throw new CliError('INVALID_ARGUMENT', 'At least one symbol is required');
}
/** @type {string[]} */
const secids = [];
for (const s of raw) {
try { secids.push(resolveSecid(s)); }
catch (err) { throw new CliError('INVALID_ARGUMENT', `Unrecognized symbol "${s}"`); }
}
// Multi-stock in one call via ulist.np
const url = new URL('https://push2.eastmoney.com/api/qt/ulist.np/get');
url.searchParams.set('secids', secids.join(','));
url.searchParams.set('fltt', '2');
url.searchParams.set('fields', FIELDS);
url.searchParams.set('ut', 'bd1d9ddb04089700cf9c27f6f7426281');
const resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0', Accept: 'application/json' } });
if (!resp.ok) throw new CliError('HTTP_ERROR', `eastmoney quote failed: HTTP ${resp.status}`);View on GitHub (pinned to 49907e53dc)
Solutions
- Pass at least one symbol, e.g. `quote --symbols=600000` or `quote --symbols=AAPL`
- In scripts, verify the symbols variable is non-empty before invoking
- Separate multiple symbols with commas or spaces: `--symbols="600000,00700.HK,AAPL"`
- Check shell quoting so the value is not eaten by the shell
Example fix
// before quote --symbols="" // after quote --symbols="600000,000001"
Defensive patterns
Strategy: validation
Validate before calling
const symbols = String(process.env.SYMBOLS || '').trim();
if (!symbols || !/[\w.]/.test(symbols)) throw new Error('SYMBOLS must contain at least one ticker, e.g. 600000 or AAPL');
await cliQuote({ symbols }); Type guard
const hasSymbols = (s) => String(s ?? '').split(/[,,\s]+/).filter(Boolean).length > 0;
Try / catch
try {
await runQuote(args);
} catch (e) {
if (e.code === 'INVALID_ARGUMENT' && /At least one symbol/.test(e.message)) {
console.error('Usage: quote --symbols="600000,00700.HK,AAPL"');
} else throw e;
} Prevention
- Always pass --symbols explicitly; never rely on possibly-empty shell variables
- Guard script variables: [ -n "$SYMBOLS" ] || exit 1 before invoking
- Quote the argument so spaces/commas survive shell parsing
- Remember commas, Chinese commas, and whitespace all act as separators
When it happens
Trigger: Calling `eastmoney quote` with no --symbols value, an empty string, or a value consisting only of separators (e.g. `--symbols=","` or `--symbols=" "`) — splitSymbols filters out empty tokens, so raw.length === 0.
Common situations: Omitting the --symbols flag entirely; passing an environment/variable that expanded to empty in shell scripts; copy-paste errors that left only delimiters; quoting mistakes that made the shell swallow the value.
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
- INVALID_ARGUMENT
- INVALID_ARGUMENT
- hf spaces sort must be one of ${SORT_OPTIONS.join(', ')}
- hf spaces limit must be a positive integer
- hf spaces sdk must be one of gradio / streamlit / docker / s
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/85b7fff567297e04.
Report an issue: GitHub.