ruvnet/ruflo · error

Either gaps or targetPath must be provided

Error message

Either gaps or targetPath must be provided

What it means

prioritize-gaps handler was given neither a gaps array (empty/undefined) nor a targetPath to scan for gaps, so there is nothing to prioritize. The input guard fires after zod validation because both sources being absent is only detectable together.

Source

Thrown at v3/plugins/agentic-qe/src/tools/coverage-analysis/prioritize-gaps.ts:156

 */
export async function handler(
  input: PrioritizeGapsInput,
  context: ToolContext
): Promise<{ content: Array<{ type: 'text'; text: string }> }> {
  const startTime = Date.now();

  try {
    // Validate input
    const validatedInput = PrioritizeGapsInputSchema.parse(input);

    // Get bridge for defect history lookup
    const bridge = context.get<{ searchSimilarPatterns: (q: string, k: number) => Promise<unknown[]> }>('aqe.bridge');

    // Get or generate gaps
    let gaps = validatedInput.gaps;
    if (!gaps || gaps.length === 0) {
      if (!validatedInput.targetPath) {
        throw new Error('Either gaps or targetPath must be provided');
      }
      gaps = await generateGapsFromPath(validatedInput.targetPath);
    }

    // Apply weights
    const weights = { ...DEFAULT_WEIGHTS, ...validatedInput.weights };

    // Calculate priority scores for each gap
    const prioritizedGaps = await calculatePriorities(
      gaps,
      validatedInput.factors,
      weights,
      bridge
    );

    // Sort by priority score
    prioritizedGaps.sort((a, b) => b.priorityScore - a.priorityScore);

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Provide all required parameters listed in the message.
  2. Validate required fields before dispatch and report the full set of missing fields at once.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/agentic-qe/src/tools/coverage-analysis/prioritize-gaps.ts:156 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/841e1b94bb3a09ce. Report an issue: GitHub.