heygen-com/hyperframes · error · RangeError

Curve outputs must be between ${outputMin} and ${outputMax}

Error message

Curve outputs must be between ${outputMin} and ${outputMax}

What it means

validateOutputRange() checks that every point's output lies within [outputMin, outputMax] after the bounds themselves pass. Any point whose output is below outputMin or above outputMax is rejected, with the bounds interpolated. This prevents a curve whose deltas escape the legal shader range (e.g. hue delta beyond [-1,1]) which would clip unpredictably in the GPU sampler.

Source

Thrown at packages/core/src/colorGradingCurves.ts:98

      throw new TypeError("Color curve points must be finite");
    }
    if (input <= previousInput) {
      throw new RangeError("Color curve inputs must be strictly increasing");
    }
    previousInput = input;
  }
}

function validateOutputRange(
  points: readonly HfColorCurvePoint[],
  outputMin: number,
  outputMax: number,
): void {
  if (!Number.isFinite(outputMin) || !Number.isFinite(outputMax) || outputMin >= outputMax) {
    throw new RangeError("Curve output bounds must be finite and increasing");
  }
  if (points.some(([, output]) => output < outputMin || output > outputMax)) {
    throw new RangeError(`Curve outputs must be between ${outputMin} and ${outputMax}`);
  }
}

function interpolateCurveSegment(
  input: number,
  start: HfColorCurvePoint,
  end: HfColorCurvePoint,
  startTangent: number,
  endTangent: number,
): number {
  const span = end[0] - start[0];
  const t = Math.min(1, Math.max(0, (input - start[0]) / span));
  const t2 = t * t;
  const t3 = t2 * t;
  return (
    (2 * t3 - 3 * t2 + 1) * start[1] +
    (t3 - 2 * t2 + t) * span * startTangent +
    (-2 * t3 + 3 * t2) * end[1] +

View on GitHub (pinned to c2996c8626)

Solutions

  1. Clamp every point's output into [outputMin, outputMax] before compiling.
  2. Align the UI slider limits to the same bounds you pass to compileHfHueCurve.

Example fix

// before
compileHfHueCurve([[0, 2.0], [180, 0], [359, -0.5]], -1, 1); // 2.0 > max

// after — clamp outputs into range
const clamped = pts.map(([h, d]) => [h, Math.min(1, Math.max(-1, d))] as const);
compileHfHueCurve(clamped, -1, 1);
Defensive patterns

Strategy: validation

Validate before calling

const clamped = points.map(([h, d]) => [h, Math.min(outputMax, Math.max(outputMin, d))] as const);

Type guard

function outputsInRange(points: readonly (readonly [number, number])[], min: number, max: number): boolean {
  return points.every(([, o]) => o >= min && o <= max);
}

Try / catch

try { compileHfHueCurve(pts, min, max); }
catch (err) { if (/outputs must be between/.test(String(err))) { pts = pts.map(([h,d]) => [h, Math.min(max, Math.max(min, d))] as const); } else throw err; }

Prevention

When it happens

Trigger: A hue curve point with delta 2.0 when bounds are [-1, 1]; a point at -1.5 with bounds [-1,1]; bounds tightened after points were authored so existing points now fall outside.

Common situations: UI letting a user drag a hue delta beyond the legal range; changing outputMin/outputMax without re-clamping existing points; importing points from a tool with a wider range.

Related errors


AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12). Data as JSON: /api/errors/867a79573cdabe61. Report an issue: GitHub.