{"record":{"id":"08b8133de4385515","repo":"BabylonJS/Babylon.js","slug":"invalid-frame-time-line","errorCode":null,"errorMessage":"Invalid frame time line","messagePattern":"Invalid frame time line","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/BVH/bvhLoader.ts","lineNumber":379,"sourceCode":"    if (framesTokens.length < 2) {\n        throw new Error(\"Invalid frame count line\");\n    }\n\n    // number of frames\n    const numFrames = parseInt(framesTokens[1]);\n    if (isNaN(numFrames)) {\n        throw new Error(\"Failed to read number of frames.\");\n    }\n    context.numFrames = numFrames;\n\n    // frame time\n    const frameTimeLine = lines.shift();\n    if (!frameTimeLine) {\n        throw new Error(\"Unexpected end of file before frame time\");\n    }\n    const frameTimeTokens = frameTimeLine.trim().split(/[\\s]+/);\n    if (frameTimeTokens.length < 3) {\n        throw new Error(\"Invalid frame time line\");\n    }\n    const frameTime = parseFloat(frameTimeTokens[2]);\n    if (isNaN(frameTime)) {\n        throw new Error(\"Failed to read frame time.\");\n    }\n    if (frameTime <= 0) {\n        throw new Error(\"Failed to read frame time. Invalid value \" + frameTime);\n    }\n\n    context.frameRate = 1 / frameTime;\n\n    // read frame data line by line\n    for (let i = 0; i < numFrames; ++i) {\n        const frameLine = lines.shift();\n        if (!frameLine) {\n            continue;\n        }\n        const tokens = frameLine.trim().split(/[\\s]+/) || [];","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/BVH/bvhLoader.ts#L361-L397","documentation":"ReadBvh splits the frame-time line on whitespace and requires at least 3 tokens (label words plus the numeric value, e.g. 'Frame Time: 0.033333'). This error is thrown when the line exists but has too few whitespace-separated tokens to contain a frame time value.","triggerScenarios":"A 'Frame Time:' line written as 'FrameTime' (one token), 'Frame Time' (two tokens, no value), an empty/blank line where the frame time should be, or a file using an unexpected label format at that position.","commonSituations":"Hand-edited BVH files, exporters that write 'Frame Time:' without the numeric value, files where lines were collapsed or the value was accidentally deleted, or locale-exported files with mislabeled headers.","solutions":["Inspect the line after 'Frames: N' in the BVH file and ensure it reads 'Frame Time: <positive number>'","Fix or restore the frame-time line with the correct value, e.g. 'Frame Time: 0.033333'","Re-export the BVH from the original tool if the header format is nonstandard","If parsing third-party files, validate the MOTION header lines before passing to ReadBvh"],"exampleFix":"// before\nFrame Time\n// after\nFrame Time: 0.033333","handlingStrategy":"validation","validationCode":"function validateFrameTimeLine(text) {\n  const m = text.match(/^Frame Time:\\s*(.+)$/im);\n  if (!m) throw new Error('No Frame Time: line');\n  if (m[1].trim().split(/\\s+/).length < 1 || isNaN(parseFloat(m[1]))) {\n    throw new Error('Frame Time line lacks a numeric value');\n  }\n}","typeGuard":"function hasValidFrameTimeTokens(text: string): boolean {\n  const m = text.match(/^Frame Time:\\s*(.+)$/im);\n  return !!m && m[1].trim().split(/\\s+/).length >= 1;\n}","tryCatchPattern":"try {\n  skeleton.readBvh(text);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid frame time line') {\n    console.error(\"Frame Time line malformed; expected 'Frame Time: <seconds>'\");\n  } else throw e;\n}","preventionTips":["Ensure Frame Time lines always include the numeric value after the label","Avoid whitespace-stripping preprocessing that could collapse the header line","Diff hand-edited BVH files against the original export","Run a format linter on BVH assets before committing them"],"tags":["bvh","parsing","malformed-file","mocap"],"backgroundTag":"malformed-file-format","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}