{"record":{"id":"405d17f95c8c605b","repo":"jackwener/OpenCLI","slug":"query-is-required-405d17","errorCode":null,"errorMessage":"query is required","messagePattern":"query is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/search-boards.js","lineNumber":23,"sourceCode":"\nconst DEFAULT_LIMIT = 25;\nconst MAX_LIMIT = 100;\n\ncli({\n  site: 'pinterest',\n  name: 'search-boards',\n  access: 'read',\n  description: 'Search for boards on Pinterest',\n  domain: 'www.pinterest.com',\n  strategy: Strategy.COOKIE,\n  args: [\n    { name: 'query', type: 'string', positional: true, required: true, help: 'Search keyword' },\n    { name: 'limit', type: 'int', default: DEFAULT_LIMIT, help: `Number of boards (max ${MAX_LIMIT})` },\n  ],\n  columns: ['boardId', 'name', 'pinCount', 'owner', 'description', 'url'],\n  func: async (page, kwargs) => {\n    const query = String(kwargs.query ?? '').trim();\n    if (!query) throw new ArgumentError('query is required');\n    const limit = requireLimit(kwargs.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });\n\n    const sourceUrl = `/search/boards/?q=${encodeURIComponent(query)}`;\n    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);\n\n    const rows = await collectResults(page, {\n      resource: 'BaseSearchResource',\n      baseOptions: { query, scope: 'boards' },\n      sourceUrl,\n      limit,\n      keyField: 'boardId',\n      pageSize: DEFAULT_PAGE_SIZE,\n      mapItem: (board) => {\n        if (!board || board.type !== 'board' || !board.id) return null;\n        return {\n          boardId: String(board.id),\n          name: board.name || '',\n          pinCount: typeof board.pin_count === 'number' ? board.pin_count : 0,","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/search-boards.js#L5-L41","documentation":"The pinterest search-boards CLI command requires a positional 'query' argument. The command normalizes the argument to a string, trims it, and throws ArgumentError when the result is empty. This guards against sending Pinterest a search URL with an empty q= parameter, which would never return meaningful results.","triggerScenarios":"Calling `pinterest search-boards` with no positional argument, with an empty string (''), or with a whitespace-only value ('   '), such that kwargs.query is undefined or trims to ''.","commonSituations":"Shell variables that expand to empty (e.g. QUERY=\"\"; pinterest search-boards \"$QUERY\"), quoting mistakes that drop the argument, scripts where the user skipped a prompt, or piping an empty stdin value into the command.","solutions":["Pass a non-empty search keyword as the first positional argument: pinterest search-boards \"diy home\"","Check the shell variable you are interpolating actually has a value before invoking the command","Quote the argument so the shell does not swallow it: pinterest search-boards \"${QUERY}\""],"exampleFix":"// before\npinterest search-boards $QUERY   // QUERY is empty -> ArgumentError\n// after\nif [ -z \"$QUERY\" ]; then echo \"query is required\" >&2; exit 1; fi\npinterest search-boards \"$QUERY\"","handlingStrategy":"validation","validationCode":"const query = typeof argv.query === 'string' ? argv.query.trim() : '';\nif (!query) { console.error('usage: pinterest search-boards <query>'); process.exit(2); }","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Always quote positional search arguments in shell scripts","Validate shell variables with ${VAR:?msg} before invoking the CLI","Check --help to confirm which arguments are positional and required"],"tags":["cli","argument-validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}