{"record":{"id":"3efa568a08692a2c","repo":"mrdoob/three.js","slug":"three-keyframetrack-track-name-is-undefined","errorCode":null,"errorMessage":"THREE.KeyframeTrack: track name is undefined","messagePattern":"THREE\\.KeyframeTrack: track name is undefined","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/animation/KeyframeTrack.js","lineNumber":31,"sourceCode":"\n/**\n * Represents a timed sequence of keyframes, which are composed of lists of\n * times and related values, and which are used to animate a specific property\n * of an object.\n */\nclass KeyframeTrack {\n\n\t/**\n\t * Constructs a new keyframe track.\n\t *\n\t * @param {string} name - The keyframe track's name.\n\t * @param {Array<number>} times - A list of keyframe times.\n\t * @param {Array<number|string|boolean>} values - A list of keyframe values.\n\t * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} [interpolation] - The interpolation type.\n\t */\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\t/**\n\t\t * The track's name can refer to morph targets or bones or\n\t\t * possibly other values within an animated object. See {@link PropertyBinding#parseTrackName}\n\t\t * for the forms of strings that can be parsed for property binding.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tthis.name = name;\n\n\t\t/**\n\t\t * The keyframe times.\n\t\t *\n\t\t * @type {Float32Array}\n\t\t */\n\t\tthis.times = AnimationUtils.convertArray( times, this.TimeBufferType );\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/animation/KeyframeTrack.js#L13-L49","documentation":"Thrown by the KeyframeTrack constructor when the name argument is undefined. The track name encodes the property binding (e.g. 'bone.position', 'mesh.morphTargetInfluences[0]') and is mandatory; without it the track cannot be bound to any object. The check runs before times/values validation.","triggerScenarios":"Constructing new KeyframeTrack(undefined, times, values). Building tracks programmatically and forgetting to pass the name, or passing a variable that resolved to undefined (e.g. a missing field on a config object).","commonSituations":"Programmatic animation builders where the property path is computed from data that can be absent. Deserialization code that reads track.name from JSON without defaulting. Destructuring bugs that drop the name.","solutions":["Pass a non-empty name string as the first argument, following the PropertyBinding track-name grammar (nodeName.property or the documented forms).","If the name comes from data, default/validate it before constructing the track and skip or log when it is absent.","Double-check destructuring/argument order: new KeyframeTrack(name, times, values, interpolation)."],"exampleFix":"// before\ntracks.push( new KeyframeTrack( cfg.prop, times, values ) ); // cfg.prop is undefined\n\n// after\nif ( ! cfg.prop ) throw new Error( 'track config missing prop name' );\ntracks.push( new KeyframeTrack( cfg.prop, times, values ) );","handlingStrategy":"type-guard","validationCode":"function makeTrack( name, times, values, interpolation ) {\n  if ( typeof name !== 'string' || name.length === 0 ) {\n    throw new TypeError( 'KeyframeTrack requires a non-empty name' );\n  }\n  return new THREE.KeyframeTrack( name, times, values, interpolation );\n}","typeGuard":"function isValidTrackName( name ) {\n  return typeof name === 'string' && name.length > 0 && name.includes( '.' );\n}","tryCatchPattern":"try {\n  track = new THREE.KeyframeTrack( name, times, values );\n} catch ( err ) {\n  if ( /track name is undefined/.test( err.message ) ) {\n    throw new Error( `Refusing to build track: name resolved to undefined (source=${String(name)})` );\n  }\n  throw err;\n}","preventionTips":["Always pass a name of the form 'node.property'; validate it is a non-empty string first.","When building tracks from data, default/skip entries whose name is missing.","Check argument order: new KeyframeTrack(name, times, values, interpolation)."],"tags":["animation","keyframe","constructor","validation"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}