{"record":{"id":"76fafbd794e9bbb9","repo":"jackwener/OpenCLI","slug":"qoder-search","errorCode":null,"errorMessage":"qoder search","messagePattern":"qoder search","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/qoder/ui.js","lineNumber":107,"sourceCode":"      input.dispatchEvent(new Event('change', { bubbles: true }));\n      return { ok: true };\n    })()`);\n        if (!fillRes?.ok) throw new CommandExecutionError(fillRes?.reason || 'search type failed', '');\n        await page.wait(0.8);\n        const items = requireArrayResult(await evaluateQoder(page, `(() => {\n      ${IS_VISIBLE_JS}\n      // Search palette results: prefer [role=option], else any clickable row in the modal.\n      const opts = Array.from(document.querySelectorAll('[role=\"option\"], [role=\"menuitem\"]')).filter(isVisible);\n      const titles = opts.map((o) => {\n        // Codex-style fix: text may be in per-char spans; use textContent.\n        const titleEl = o.querySelector('.truncate, [class*=\"title\"i]') || o;\n        return (titleEl.textContent || '').trim().replace(/\\\\s+/g, ' ').slice(0, 200);\n      }).filter(Boolean);\n      return [...new Set(titles)];\n    })()`), 'qoder search');\n        try { await page.evaluate(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));`); } catch {}\n        if (!items.length) {\n            throw new EmptyResultError('qoder search', `No items matched \"${query}\".`);\n        }\n        return items.slice(0, limit).map((t, i) => ({ Index: i + 1, Item: t }));\n    },\n});\n\n// -------- settings --------\ncli({\n    site: 'qoder',\n    name: 'settings',\n    access: 'write',\n    description: 'Click the Settings button in the Qoder sidebar.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],\n    func: async (page) => {\n        const res = await evaluateQoder(page, clickByTextScript(['Settings']));","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qoder/ui.js#L89-L125","documentation":"Thrown by the qoder search command when the search results scrape (requireArrayResult over [role=option]/[role=menuitem] titles) yields an empty list, meaning no items matched the query. EmptyResultError includes the query in the message so the user knows what to adjust. This is an expected, data-level empty result rather than a script failure.","triggerScenarios":"The query genuinely matches nothing in Qoder's searchable items; the query is misspelled or too specific; results render in elements that are neither role=option nor role=menuitem after a Qoder update; results hadn't loaded yet when the scrape ran (only 0.8s wait).","commonSituations":"Searching a term before the search index loads; typos in the query; searching for content types the palette doesn't index; slow backend returning results after the scrape.","solutions":["Retry with a broader/shorter query or check spelling.","Increase the post-type wait (currently 0.8s) or poll until results appear.","If results exist in the UI but aren't extracted, update the result selectors ([role=option]/[role=menuitem]) to the current markup.","Escape the palette (already attempted) and rerun the search once."],"exampleFix":"// before\nawait page.wait(0.8);\nconst items = requireArrayResult(await evaluateQoder(page, RESULTS_JS), 'qoder search');\n// after\nlet items = [];\nfor (let i = 0; i < 5; i++) {\n  await page.wait(0.5);\n  items = requireArrayResult(await evaluateQoder(page, RESULTS_JS), 'qoder search');\n  if (items.length) break;\n}","handlingStrategy":"retry","validationCode":"const query = 'my search term'.trim();\nif (query.split(/\\s+/).length > 6) console.warn('Long queries may match nothing; try broader terms');","typeGuard":"function hasItems(v) { return Array.isArray(v) && v.length > 0; }","tryCatchPattern":"try {\n  const items = await search(page, query);\n} catch (e) {\n  if (e instanceof EmptyResultError && /qoder search/.test(e.message)) {\n    return search(page, query.split(/\\s+/)[0]);\n  }\n  throw e;\n}","preventionTips":["Use shorter, broader search terms and refine iteratively.","Poll for results instead of a single fixed wait.","Check spelling before concluding nothing matches.","If the UI shows results but the CLI reports none, update the [role=option]/[role=menuitem] selectors."],"tags":["empty-result","search","scraping"],"backgroundTag":"empty-search-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}