heygen-com/hyperframes · error · RangeError

Curve output bounds must be finite and increasing

Error message

Curve output bounds must be finite and increasing

What it means

validateOutputRange() requires outputMin and outputMax to both be finite and strictly increasing (outputMin < outputMax). It throws a RangeError otherwise. This is used by compileHfHueCurve (hue delta bounds) and by compileCurveSamples for any curve with custom output bounds; the bounds define the clamp range and the slope scaling, so equal/infinite bounds break both.

Source

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

  let previousInput = Number.NEGATIVE_INFINITY;
  for (const [input, output] of points) {
    if (!Number.isFinite(input) || !Number.isFinite(output)) {
      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 (

View on GitHub (pinned to c2996c8626)

Solutions

  1. Pass outputMin < outputMax with both finite; for hue curves typical bounds are e.g. -1 and 1 (or your effect's delta range).
  2. Normalize min/max before calling: const [lo, hi] = [Math.min(a,b), Math.max(a,b)].

Example fix

// before
const lut = compileHfHueCurve(pts, 1, 1); // min == max

// after
const lut = compileHfHueCurve(pts, -1, 1); // finite, min < max
Defensive patterns

Strategy: validation

Validate before calling

function validBounds(min: number, max: number): boolean {
  return Number.isFinite(min) && Number.isFinite(max) && min < max;
}
if (!validBounds(outputMin, outputMax)) throw new Error('output bounds must be finite and min < max');

Type guard

function isValidOutputBounds(min: unknown, max: unknown): boolean {
  return typeof min === "number" && typeof max === "number" && Number.isFinite(min) && Number.isFinite(max) && min < max;
}

Try / catch

try { compileHfHueCurve(pts, outputMin, outputMax); }
catch (err) { if (/bounds must be finite and increasing/.test(String(err))) { /* fix min<max */ } else throw err; }

Prevention

When it happens

Trigger: Calling compileHfHueCurve with outputMin >= outputMax (e.g. 0 and 0, or -1 and -2), or either bound NaN/Infinity; passing bounds in the wrong order.

Common situations: A hue curve with delta range derived from a slider pair where min was dragged above max; NaN from an uninitialised variable; sign confusion (expecting max,min).

Related errors


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