affaan-m/ECC · error · Error

Consult requires a natural language query, for example: secu

Error message

Consult requires a natural language query, for example: security reviews

What it means

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.

Source

Thrown at scripts/consult.js:397

      };
    })
    .filter(result => result.score > 0)
    .sort((left, right) => right.score - left.score || left.profile.id.localeCompare(right.profile.id))
    .slice(0, Math.min(3, limit))
    .map(result => ({
      id: result.profile.id,
      description: result.profile.description,
      moduleCount: result.profile.moduleCount,
      score: result.score,
      reasons: result.reasons.length > 0 ? result.reasons : ['related install profile'],
      installCommand: commandFor('profile', result.profile.id, target),
    }));
}

function buildConsultation(options) {
  const queryTokens = tokenize(options.query);
  if (queryTokens.length === 0) {
    throw new Error('Consult requires a natural language query, for example: security reviews');
  }

  const matches = rankComponents({
    queryTokens,
    target: options.target,
    limit: options.limit,
  });
  const profiles = rankProfiles({
    queryTokens,
    target: options.target,
    limit: options.limit,
  });

  return {
    schemaVersion: SCHEMA_VERSION,
    query: options.query,
    target: options.target,
    generatedAt: new Date().toISOString(),

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Provide a descriptive natural-language query, e.g. `node scripts/consult.js security reviews`
  2. If the query comes from a variable, ensure it is non-empty and contains at least one content word
  3. Avoid queries composed entirely of common stop words

Example fix

// before
node scripts/consult.js
node scripts/consult.js the a
// after
node scripts/consult.js security reviews
Defensive patterns

Strategy: validation

Validate before calling

// Verify the query has at least one meaningful token before running
const STOP_WORDS = new Set(['the', 'a', 'an', 'is', 'are', 'of', 'to', 'in', 'for', 'and', 'or', 'on', 'at', 'by', 'with']);
function hasMeaningfulQuery(query) {
  return query.split(/\s+/).filter(t => t && !STOP_WORDS.has(t.toLowerCase())).length > 0;
}
const query = process.argv.slice(2).filter(a => !a.startsWith('-')).join(' ');
if (!hasMeaningfulQuery(query)) {
  console.error('Consult requires a natural language query, e.g. "security reviews"');
  process.exit(1);
}

Try / catch

try {
  const consultation = buildConsultation(options);
} catch (error) {
  if (error.message.includes('requires a natural language query')) {
    console.error('No searchable query provided.');
    console.error('Example: node scripts/consult.js security reviews');
    console.error('Example: node scripts/consult.js react frontend patterns');
    process.exit(2);
  }
  throw error;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/783da80523ea145b. Report an issue: GitHub.