{"record":{"id":"bbb05c87f23340a9","repo":"mrdoob/three.js","slug":"three-keyframetrack-track-type-undefined-can-not","errorCode":null,"errorMessage":"THREE.KeyframeTrack: track type undefined, can not parse","messagePattern":"THREE\\.KeyframeTrack: track type undefined, can not parse","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/animation/AnimationClip.js","lineNumber":458,"sourceCode":"\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tAnimationUtils.flattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/animation/AnimationClip.js#L440-L476","documentation":"Thrown by parseKeyframeTrack() when a track object in an AnimationClip JSON has no 'type' field at all. The type is required to select the KeyframeTrack subclass via getTrackTypeForValueTypeName(); without it, parsing cannot proceed. This fires before the unsupported-type-name check (error [14]).","triggerScenarios":"An animation clip JSON whose tracks array contains an entry missing the type key. Manually constructing clip JSON and omitting type. A truncated/malformed serialization where the type field was dropped.","commonSituations":"Hand-editing exported animation JSON. A bug in a custom exporter that skips the type field for certain tracks. Loading a partially-corrupt clip file.","solutions":["Inspect each track in the clip JSON and add the missing 'type' field with a supported value-type name (e.g. 'vector3', 'quaternion', 'scalar').","Re-export the clip from the source (Blender/glTF) rather than hand-editing, so type is always populated.","If loading untrusted animation data, validate up front that every track has a non-empty type before calling AnimationClip.parse()."],"exampleFix":"// before\n{ \"tracks\": [ { \"name\": \"x.position\", \"times\": [0], \"values\": [0] } ] }\n// -> 'track type undefined, can not parse'\n\n// after — add the type field\n{ \"tracks\": [ { \"name\": \"x.position\", \"type\": \"vector3\", \"times\": [0], \"values\": [0,0,0] } ] }","handlingStrategy":"validation","validationCode":"function validateClipTracks( clipJson ) {\n  for ( const t of clipJson.tracks || [] ) {\n    if ( t.type === undefined ) throw new Error( `track '${t.name}' is missing 'type'` );\n  }\n}","typeGuard":"function trackHasType( track ) {\n  return track !== null && typeof track === 'object' && typeof track.type === 'string' && track.type.length > 0;\n}","tryCatchPattern":"try {\n  clip = AnimationClip.parse( json );\n} catch ( err ) {\n  if ( /track type undefined/.test( err.message ) ) {\n    console.error( 'Skipping clip with untyped track(s).', json );\n    clip = null;\n  } else throw err;\n}","preventionTips":["Always serialize tracks with a 'type' field; re-export rather than hand-edit clip JSON.","Before AnimationClip.parse, assert every track has a non-empty type.","Audit custom exporters to ensure type is emitted for every track."],"tags":["animation","keyframe","json","parsing","validation"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}