{"record":{"id":"1c38c02997af37dd","repo":"BabylonJS/Babylon.js","slug":"no-animation-range-found-in-skeleton","errorCode":null,"errorMessage":"No animation range found in skeleton","messagePattern":"No animation range found in skeleton","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/serializers/src/BVH/bvhSerializer.ts","lineNumber":48,"sourceCode":"        }\n\n        // Calculate overall animation range from all specified animations\n        let overallRange: Nullable<AnimationRange> = null;\n        for (const animName of animationsToExport) {\n            const range = skeleton.getAnimationRange(animName);\n            if (range) {\n                overallRange = overallRange ? new AnimationRange(\"animation-range\", Math.min(overallRange.from, range.from), Math.max(overallRange.to, range.to)) : range;\n            }\n        }\n\n        if (!overallRange) {\n            // If no animation range found, try to get from any animation\n            if (skeleton.animations.length > 0) {\n                overallRange = skeleton.getAnimationRange(skeleton.animations[0].name);\n            }\n\n            if (!overallRange) {\n                throw new Error(\"No animation range found in skeleton\");\n            }\n        }\n\n        // Calculate frame rate from animation data if not provided\n        const actualFrameRate = frameRate || 1 / (skeleton.animations[0]?.framePerSecond || 30);\n\n        // Build bone hierarchy and collect animation data\n        const boneHierarchy = this._BuildBoneHierarchy(skeleton, animationsToExport);\n\n        // Calculate frame count from actual animation keyframes\n        let frameCount = 0;\n        for (const boneData of boneHierarchy) {\n            if (boneData.positionKeys.length > 0) {\n                frameCount = Math.max(frameCount, boneData.positionKeys.length);\n            }\n            if (boneData.rotationKeys.length > 0) {\n                frameCount = Math.max(frameCount, boneData.rotationKeys.length);\n            }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/serializers/src/BVH/bvhSerializer.ts#L30-L66","documentation":"Export needs an animation frame range (from/to frames) to emit BVH MOTION frames. When no range was supplied via skeleton.getAnimationRange for the target animation and no fallback animation range could be found (no animations, or animations have no registered ranges), the exporter throws because it cannot determine the frame count or timing.","triggerScenarios":"Calling Export with animationNames pointing at an animation that has no AnimationRange registered in the skeleton, and the fallback (skeleton.animations[0]) is also missing or range-less; animations attached but never played/registered so getAnimationRange returns null.","commonSituations":"Ranges cleared by stopAnimation/cleanup; animations imported without range metadata; passing a wrong animation name string; a skeleton cloned without carrying animation ranges.","solutions":["Ensure an animation range exists: skeleton.createAnimationRange(name, from, to) or verify with skeleton.getAnimationRange(name) before export","Pass a valid animation name that actually exists in skeleton.animations","Pass an explicit frameRate and ensure at least one animation with a range is present"],"exampleFix":"// before\nBVHExporter.Export(skeleton, [\"walk\"]); // throws if 'walk' has no range\n// after\nskeleton.createAnimationRange(\"walk\", 0, 60);\nBVHExporter.Export(skeleton, [\"walk\"]);","handlingStrategy":"validation","validationCode":"const range = skeleton.getAnimationRange(animName)\n  ?? (skeleton.animations.length > 0 ? skeleton.getAnimationRange(skeleton.animations[0].name) : null);\nif (!range) throw new Error(`no animation range for '${animName}'; call skeleton.createAnimationRange(...)`);","typeGuard":null,"tryCatchPattern":"try {\n  const bvh = BVHExporter.Export(skeleton, [animName]);\n} catch (e) {\n  if (String(e.message).includes(\"No animation range\")) {\n    skeleton.createAnimationRange(animName, 0, frameCount - 1);\n    bvh = BVHExporter.Export(skeleton, [animName]);\n  } else throw e;\n}","preventionTips":["Register ranges with skeleton.createAnimationRange for every animation you intend to export","Confirm animation names exist in skeleton.animations (case-sensitive)","Re-create ranges after cloning or re-importing a skeleton"],"tags":["bvh","animation","skeleton","export","missing-data"],"backgroundTag":"missing-animation-range","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}