{"record":{"id":"09890101839f1c51","repo":"moeru-ai/airi","slug":"the-current-motion-has-no-changing-channels","errorCode":null,"errorMessage":"The current motion has no changing channels.","messagePattern":"The current motion has no changing channels\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/motion-driver-magic/src/shared/var.ts","lineNumber":85,"sourceCode":"  return residuals\n}\n\n/** Fits the VAR parameters that both public methods use. */\nexport function fitVarParameters(sequence: TrainingSequence, options: VarFitOptions): VarParameters {\n  if (!Number.isFinite(sequence.sampleRateHz) || sequence.sampleRateHz <= 0)\n    throw new Error('The motion sample rate must be positive.')\n  if (options.order < 1 || !Number.isInteger(options.order))\n    throw new Error('The VAR order must be a positive integer.')\n\n  const frames = sequence.frames\n  if (frames.length === 0 || frames[0].length === 0)\n    throw new Error('The motion sequence must contain at least one value.')\n  if (frames.some(frame => frame.length !== frames[0].length))\n    throw new Error('Every motion frame must have the same number of values.')\n\n  const channels = createMotionChannels(frames)\n  if (channels.length === 0)\n    throw new Error('The current motion has no changing channels.')\n  if (frames.length <= options.order + 1)\n    throw new Error('The current motion is too short for this VAR order.')\n\n  const baselineFrame = createBaselineFrame(frames)\n  const trainingFrames = frames.map(frame => channels.map(\n    channel => (frame[channel.valueIndices[0]] - channel.mean) / channel.scale,\n  ))\n  const coefficients = fitCoefficients(trainingFrames, options)\n  const residuals = createResiduals(trainingFrames, coefficients, options.order)\n  const squaredResidualSum = residuals.reduce(\n    (sum, residual) => sum + residual.reduce((channelSum, value) => channelSum + value ** 2, 0),\n    0,\n  )\n\n  return {\n    options,\n    sampleRateHz: sequence.sampleRateHz,\n    sourceFrameCount: frames.length,","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/motion-driver-magic/src/shared/var.ts#L67-L103","documentation":"After validating frame shape, fitVarParameters derives channels via createMotionChannels, which keeps only value streams that actually change across frames. If no channel varies, the VAR model would divide by zero scale and fit meaningless coefficients, so the function throws. A completely static motion cannot be modeled.","triggerScenarios":"Calling fitVarParameters with a sequence where every frame has identical values (all channels constant), e.g. a single pose repeated N times.","commonSituations":"Passing a frozen/rest-pose clip as training data; a preprocessing step over-normalized all values to the same constant; slicing a sequence down to one frame (single frame means every channel is constant).","solutions":["Supply a motion sequence that actually animates (values differ across frames)","Check preprocessing/normalization steps that could flatten all values to a constant","Avoid single-frame or repeated-frame inputs; include enough varied frames","Detect constant channels upstream and warn the user instead of reaching the fit call"],"exampleFix":"// before\nconst frames = [[0, 0], [0, 0], [0, 0]] // static motion\nfitVarParameters({ frames, ... }, options)\n// after\nconst frames = [[0, 0], [0.5, 1], [1, 0.2]] // values change over time\nfitVarParameters({ frames, ... }, options)","handlingStrategy":"validation","validationCode":"function hasChangingChannels(frames: number[][]): boolean {\n  return frames[0].some((_, i) => frames.some(f => f[i] !== frames[0][i]))\n}\nif (!hasChangingChannels(sequence.frames)) throw new Error('Motion has no changing channels')","typeGuard":"function isNonStaticSequence(v: unknown): v is number[][] {\n  if (!Array.isArray(v) || v.length < 2 || !Array.isArray(v[0])) return false\n  return v[0].some((_, i) => v.some(f => f[i] !== v[0][i]))\n}","tryCatchPattern":"try {\n  const params = fitVarParameters(sequence, options)\n} catch (e) {\n  if (e instanceof Error && e.message === 'The current motion has no changing channels.') {\n    // fall back to a non-parametric idle animation or prompt for another clip\n  } else throw e\n}","preventionTips":["Check for constant columns before fitting and drop/flag static clips","Beware single-frame sequences — every channel is constant by definition","Review normalization pipelines that could collapse values to one constant","Require at least a few distinct frames in any training clip you select"],"tags":["validation","motion-data","var"],"backgroundTag":"static-motion-input","analyzedSha":"9c213115f8bd0fff9e6eabab02b077ac32da21be","analyzedAt":"2026-09-02T04:27:24.639Z","contentChangedAt":"2026-09-02T04:27:24.639Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}