{"record":{"id":"0600fe2e443a6f40","repo":"jackwener/OpenCLI","slug":"xueqiu-comments-requires-a-symbol","errorCode":null,"errorMessage":"xueqiu comments requires a symbol","messagePattern":"xueqiu comments requires a symbol","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/comments.js","lineNumber":347,"sourceCode":"            limit,\n            pageSize,\n            maxRequests: 5,\n            fetchPage: (pageNumber, currentPageSize) => fetchCommentsPage(page, symbol, pageNumber, currentPageSize),\n            warn: log.warn,\n        });\n        return rows.map(row => toCommentOutputRow(row));\n    },\n});\n/**\n * Convert raw CLI input into a normalized stock symbol.\n *\n * @param raw User-provided CLI argument.\n * @returns Upper-cased symbol string.\n */\nexport function normalizeSymbolInput(raw) {\n    const symbol = String(raw ?? '').trim().toUpperCase();\n    if (!symbol)\n        throw new ArgumentError('xueqiu comments requires a symbol');\n    if (/^HTTPS?:\\/\\//.test(symbol)) {\n        throw new ArgumentError('xueqiu comments only accepts a symbol, not a URL');\n    }\n    if (!XUEQIU_SYMBOL_PATTERN.test(symbol)) {\n        throw new ArgumentError(`xueqiu comments received an invalid symbol: ${symbol}`);\n    }\n    return symbol;\n}\n","sourceCodeStart":329,"sourceCodeEnd":356,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/comments.js#L329-L356","documentation":"normalizeSymbolInput in clis/xueqiu/comments.js normalizes the required positional symbol argument and throws this ArgumentError when the raw input is missing, null, undefined, or whitespace-only. A symbol is mandatory for building the xueqiu comments API request.","triggerScenarios":"Calling the comments command without the positional symbol argument, or passing an empty string, whitespace, null, or undefined (String(raw ?? '').trim() yields '').","commonSituations":"Scripting with an unset shell variable (symbol=\"$SYMBOL\" where SYMBOL is empty), forgetting the positional argument entirely, or a config file providing a blank symbol.","solutions":["Provide the positional symbol, e.g. clis/xueqiu comments SH600519.","In scripts, guard the variable before calling: [ -n \"$SYMBOL\" ] || exit 1.","Trim whitespace from config-driven values before passing them."],"exampleFix":"// before\nclis/xueqiu comments\n// after\nclis/xueqiu comments SH600519","handlingStrategy":"validation","validationCode":"const symbol = (rawSymbol ?? '').trim();\nif (!symbol) throw new Error('symbol is required');","typeGuard":"const hasSymbol = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Always include the positional symbol argument.","Guard interpolated shell variables for emptiness before invoking.","Trim config-driven values before passing."],"tags":["cli","missing-argument","xueqiu"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}