{"record":{"id":"10fb49d6547211a1","repo":"jackwener/OpenCLI","slug":"query-is-required-10fb49","errorCode":null,"errorMessage":"query is required","messagePattern":"query is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/search-pins.js","lineNumber":23,"sourceCode":"\nconst DEFAULT_LIMIT = 25;\nconst MAX_LIMIT = 100;\n\ncli({\n  site: 'pinterest',\n  name: 'search-pins',\n  access: 'read',\n  description: 'Search pins 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 pins (max ${MAX_LIMIT})` },\n  ],\n  columns: ['pinId', 'title', 'description', 'pinner', 'board', 'imageUrl', 'url'],\n  func: async (page, kwargs) => {\n    const query = String(kwargs.query ?? '').trim();\n    if (!query) throw new ArgumentError('query is required');\n\n    const limit = requireLimit(kwargs.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });\n    const sourceUrl = `/search/pins/?q=${encodeURIComponent(query)}`;\n\n    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);\n\n    const rows = await collectPins(page, {\n      resource: 'BaseSearchResource',\n      baseOptions: { query, scope: 'pins', appliedProductFilters: '---', auto_correction_disabled: false },\n      sourceUrl,\n      limit,\n      pageSize: DEFAULT_PAGE_SIZE,\n    });\n\n    if (rows.length === 0) {\n      throw new EmptyResultError('pinterest search-pins', `no pins found for \"${query}\"`);\n    }\n    return rows;","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/search-pins.js#L5-L41","documentation":"The pinterest search-pins CLI command requires a positional 'query' argument. It stringifies, trims, and rejects empty values with ArgumentError before building the /search/pins/?q= URL, because a blank keyword cannot produce a valid Pinterest search.","triggerScenarios":"Invoking search-pins with no positional argument, an empty string, or whitespace only, so String(kwargs.query ?? '').trim() equals ''.","commonSituations":"Forgetting the keyword after flags (pinterest search-pins --limit 10), an env/config variable that is unset, or a wrapper script that fails to forward its own arguments.","solutions":["Provide the keyword positionally: pinterest search-pins \"meal prep\"","Audit the calling script/wrapper to ensure it forwards arguments (use \"$@\")","Set or export the variable feeding the query before running the command"],"exampleFix":"// before\npinterest search-pins --limit 5      // no positional query\n// after\npinterest search-pins \"meal prep\" --limit 5","handlingStrategy":"validation","validationCode":"const query = process.argv[2] ?? '';\nif (!query.trim()) { console.error('query is required'); process.exit(2); }","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Put the keyword before flags so it is never confused with an option value","Forward args in wrapper scripts using \"$@\"","Fail fast with a usage message when the positional arg is absent"],"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"}