ruvnet/ruflo · error

Vectors must have same dimension

Error message

Vectors must have same dimension

What it means

Thrown by mobiusAdd when the two input vectors a and b have different lengths; Möbius addition in the Poincaré ball is only defined element-wise over vectors of identical dimension, so any dimension mismatch aborts before the curvature/epsilon math begins.

Source

Thrown at v3/@claude-flow/embeddings/src/hyperbolic.ts:209

 * Möbius addition in Poincaré ball
 *
 * Hyperbolic "addition" operation that respects the ball geometry.
 *
 * @param a - First vector
 * @param b - Second vector
 * @param config - Configuration
 * @returns a ⊕ b in hyperbolic space
 */
export function mobiusAdd(
  a: Float32Array | number[],
  b: Float32Array | number[],
  config: HyperbolicConfig = {}
): Float32Array {
  const { curvature, epsilon, maxNorm } = { ...DEFAULT_CONFIG, ...config };
  const c = Math.abs(curvature);

  if (a.length !== b.length) {
    throw new Error('Vectors must have same dimension');
  }

  let normASq = 0;
  let normBSq = 0;
  for (let i = 0; i < a.length; i++) {
    normASq += a[i] * a[i];
    normBSq += b[i] * b[i];
  }

  // <a, b>
  let dotAB = 0;
  for (let i = 0; i < a.length; i++) {
    dotAB += a[i] * b[i];
  }

  // Möbius addition formula
  const numeratorCoeffA = 1 + 2 * c * dotAB + c * normBSq;
  const numeratorCoeffB = 1 - c * normASq;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Ensure both vectors come from the same embedding model before the operation.
  2. Check this.dimensions against the input length and regenerate the shorter vector.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/embeddings/src/hyperbolic.ts:209 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/11d521613bcc137a. Report an issue: GitHub.