ruvnet/ruflo · error

Invalid number of variables: ${problem.variables} (must be 1

Error message

Invalid number of variables: ${problem.variables} (must be 1-10000)

What it means

validateQuboProblem() found problem.variables outside the supported 1–10000 range. The solver allocates arrays sized by variable count, so zero, negative, or oversized problems are rejected up front before annealing begins.

Source

Thrown at v3/plugins/quantum-optimizer/src/bridges/exotic-bridge.ts:331

    const successProb = solutions.length > 0
      ? Math.min(1, solutions.length / Math.sqrt(space.size))
      : 0;

    return {
      solutions,
      queries,
      optimalQueries: optimalIterations,
      successProbability: successProb,
    };
  }

  // ============================================================================
  // Private Helper Methods
  // ============================================================================

  private validateQuboProblem(problem: QUBOProblem): void {
    if (problem.variables < 1 || problem.variables > 10000) {
      throw new Error(`Invalid number of variables: ${problem.variables} (must be 1-10000)`);
    }

    if (problem.linear.length !== problem.variables) {
      throw new Error(`Linear coefficients length mismatch: ${problem.linear.length} vs ${problem.variables}`);
    }

    const expectedQuadratic = (problem.variables * (problem.variables - 1)) / 2;
    if (problem.quadratic.length !== expectedQuadratic && problem.quadratic.length !== 0) {
      throw new Error(`Quadratic coefficients length mismatch: ${problem.quadratic.length} vs ${expectedQuadratic}`);
    }
  }

  private validateProblemGraph(graph: ProblemGraph): void {
    if (graph.nodes < 1 || graph.nodes > 1000) {
      throw new Error(`Invalid number of nodes: ${graph.nodes} (must be 1-1000)`);
    }

    for (const [u, v] of graph.edges) {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Correct the invalid input element reported in the message; validate the full input against the documented schema before submitting.
  2. Add boundary validation so malformed input is rejected with a per-element diagnostic.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/quantum-optimizer/src/bridges/exotic-bridge.ts:331 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/e747563356a612f9. Report an issue: GitHub.