{"record":{"id":"783da80523ea145b","repo":"affaan-m/ECC","slug":"consult-requires-a-natural-language-query-for-exa","errorCode":null,"errorMessage":"Consult requires a natural language query, for example: security reviews","messagePattern":"Consult requires a natural language query, for example: security reviews","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/consult.js","lineNumber":397,"sourceCode":"      };\n    })\n    .filter(result => result.score > 0)\n    .sort((left, right) => right.score - left.score || left.profile.id.localeCompare(right.profile.id))\n    .slice(0, Math.min(3, limit))\n    .map(result => ({\n      id: result.profile.id,\n      description: result.profile.description,\n      moduleCount: result.profile.moduleCount,\n      score: result.score,\n      reasons: result.reasons.length > 0 ? result.reasons : ['related install profile'],\n      installCommand: commandFor('profile', result.profile.id, target),\n    }));\n}\n\nfunction buildConsultation(options) {\n  const queryTokens = tokenize(options.query);\n  if (queryTokens.length === 0) {\n    throw new Error('Consult requires a natural language query, for example: security reviews');\n  }\n\n  const matches = rankComponents({\n    queryTokens,\n    target: options.target,\n    limit: options.limit,\n  });\n  const profiles = rankProfiles({\n    queryTokens,\n    target: options.target,\n    limit: options.limit,\n  });\n\n  return {\n    schemaVersion: SCHEMA_VERSION,\n    query: options.query,\n    target: options.target,\n    generatedAt: new Date().toISOString(),","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/consult.js#L379-L415","documentation":"In consult.js buildConsultation(), the query string is tokenized and filtered through stop-word removal and token expansion. If after this processing zero tokens remain, the error is thrown. This catches empty queries, queries consisting entirely of stop words (e.g. 'the', 'a', 'is'), and queries that produce no expandable tokens. The minimum requirement is at least one meaningful, non-stop-word token.","triggerScenarios":"Running consult.js with no query words at all; passing only stop words like 'the a is'; passing punctuation-only input; or a query where every word is filtered out by the STOP_WORDS set.","commonSituations":"Running the script without a query; wrapper scripts that pass an empty or whitespace-only variable as the query; users testing the CLI with placeholder text.","solutions":["Provide a descriptive natural-language query, e.g. `node scripts/consult.js security reviews`","If the query comes from a variable, ensure it is non-empty and contains at least one content word","Avoid queries composed entirely of common stop words"],"exampleFix":"// before\nnode scripts/consult.js\nnode scripts/consult.js the a\n// after\nnode scripts/consult.js security reviews","handlingStrategy":"validation","validationCode":"// Verify the query has at least one meaningful token before running\nconst STOP_WORDS = new Set(['the', 'a', 'an', 'is', 'are', 'of', 'to', 'in', 'for', 'and', 'or', 'on', 'at', 'by', 'with']);\nfunction hasMeaningfulQuery(query) {\n  return query.split(/\\s+/).filter(t => t && !STOP_WORDS.has(t.toLowerCase())).length > 0;\n}\nconst query = process.argv.slice(2).filter(a => !a.startsWith('-')).join(' ');\nif (!hasMeaningfulQuery(query)) {\n  console.error('Consult requires a natural language query, e.g. \"security reviews\"');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const consultation = buildConsultation(options);\n} catch (error) {\n  if (error.message.includes('requires a natural language query')) {\n    console.error('No searchable query provided.');\n    console.error('Example: node scripts/consult.js security reviews');\n    console.error('Example: node scripts/consult.js react frontend patterns');\n    process.exit(2);\n  }\n  throw error;\n}","preventionTips":["Always provide at least one content word (noun, verb, adjective) as the query","Avoid queries composed entirely of articles and prepositions","Use multi-word queries for better ranking: 'security reviews' is better than 'security'","In wrapper scripts, default to a meaningful query or error out early"],"tags":["cli","validation","search","consult"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}