{"record":{"id":"0c5af51226c170cb","repo":"diegosouzapw/OmniRoute","slug":"local-corpus-search-query-is-required","errorCode":null,"errorMessage":"Local corpus search query is required","messagePattern":"Local corpus search query is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/localCorpus/index.ts","lineNumber":498,"sourceCode":"      chunks,\n      truncated: this.truncated,\n      lastIndexedAt:\n        this.lastIndexedAt === null ? null : new Date(this.lastIndexedAt).toISOString(),\n      limits: {\n        maxFiles: this.limits.maxFiles,\n        maxFileBytes: this.limits.maxFileBytes,\n        maxTotalBytes: this.limits.maxTotalBytes,\n        maxReadLines: this.limits.maxReadLines,\n      },\n    };\n  }\n\n  async search(\n    query: string,\n    options: { limit?: number; refresh?: boolean } = {}\n  ): Promise<{ query: string; results: LocalCorpusSearchResult[]; status: LocalCorpusStatus }> {\n    const normalizedQuery = query.trim().toLowerCase();\n    if (!normalizedQuery) throw new Error(\"Local corpus search query is required\");\n\n    const stale =\n      this.lastIndexedAt === null || Date.now() - this.lastIndexedAt >= this.limits.staleMs;\n    if (options.refresh === true || stale) await this.refresh();\n\n    const tokens = Array.from(new Set(normalizedQuery.split(/\\s+/).filter(Boolean)));\n    const limit = Math.min(positiveInteger(options.limit, 10), MAX_SEARCH_RESULTS);\n    const results: LocalCorpusSearchResult[] = [];\n\n    for (const file of this.files.values()) {\n      for (const chunk of file.chunks) {\n        const score = scoreChunk(chunk, normalizedQuery, tokens);\n        if (score === 0) continue;\n        results.push({\n          relativePath: file.relativePath,\n          startLine: chunk.startLine,\n          endLine: chunk.endLine,\n          score,","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/localCorpus/index.ts#L480-L516","documentation":"Error \"Local corpus search query is required\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/localCorpus/index.ts:498 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}