{"record":{"id":"ade701335131b368","repo":"greensock/GSAP","slug":"gsdevtools-error-invalid-animation","errorCode":null,"errorMessage":"GSDevTools error: invalid animation.","messagePattern":"GSDevTools error: invalid animation\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/GSDevTools.js","lineNumber":756,"sourceCode":"\t\t\t\t\tmatches = (i && animations[i].vars.id === animations[i-1].vars.id) ? matches + 1 : 0;\n\t\t\t\t\toption.setAttribute(\"value\", (option.innerHTML = animations[i].vars.id + (matches ? \" [\" + matches + \"]\" : (animations[i+1] && animations[i+1].vars.id === animations[i].vars.id) ? \" [0]\" : \"\")));\n\t\t\t\t}\n\t\t\t\tfor (; i < options.length; i++) {\n\t\t\t\t\tlist.removeChild(options[i]);\n\t\t\t\t}\n\t\t\t},\n\t\t\tanimation = function(anim) {\n\t\t\t\tlet ts = parseFloat(timeScale.options[timeScale.selectedIndex].value) || 1,\n\t\t\t\t\ttl, maxDuration;\n\t\t\t\tif (!arguments.length) {\n\t\t\t\t\treturn selectedAnimation;\n\t\t\t\t}\n\t\t\t\tif (_isString(anim)) {\n\t\t\t\t\tanim = _getAnimationById(anim);\n\t\t\t\t}\n\t\t\t\t//console.log(\"animation() \", anim.vars.id);\n\t\t\t\tif (!(anim instanceof Animation)) {\n\t\t\t\t\tconsole.warn(\"GSDevTools error: invalid animation.\");\n\t\t\t\t}\n\t\t\t\tif (anim.scrollTrigger) {\n\t\t\t\t\tconsole.warn(\"GSDevTools can't work with ScrollTrigger-based animations; either the scrollbar -OR- the GSDevTools scrubber can control the animation.\");\n\t\t\t\t}\n\t\t\t\tif (anim === selectedAnimation) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (selectedAnimation) {\n\t\t\t\t\tselectedAnimation._inProgress = inProgress;\n\t\t\t\t\tselectedAnimation._outProgress = outProgress;\n\t\t\t\t}\n\t\t\t\tselectedAnimation = anim;\n\t\t\t\tif (linkedAnimation) {\n\t\t\t\t\tts = linkedAnimation.timeScale();\n\t\t\t\t\tif (linkedAnimation._targets && linkedAnimation._targets[0] === declaredAnimation) {\n\t\t\t\t\t\tdeclaredAnimation.resume();\n\t\t\t\t\t\tlinkedAnimation.kill();\n\t\t\t\t\t}","sourceCodeStart":738,"sourceCodeEnd":774,"githubUrl":"https://github.com/greensock/GSAP/blob/13e2b790546426a1a2e0e9b409f3f8dc6d6611f2/src/GSDevTools.js#L738-L774","documentation":"GSDevTools validates the animation passed to it (or via animation()) is an actual GSAP Animation instance. The value may be a string ID, in which case _getAnimationById is used to resolve it; if after resolution it is still not an Animation instance, this warning is printed. The library throws it because the scrubber/controls cannot operate on a non-animation object.","triggerScenarios":"Passing GSDevTools.create() an `animation` value that is undefined, a timeline not yet created, a misspelled string id, or a non-GSAP object (e.g. a raw DOM element, a Promise, or an animation from a different/older GSAP core).","commonSituations":"Typos in the animation `id`; referencing an animation created after GSDevTools.create() runs; passing the result of a function that returns undefined; bundlers loading two copies of gsap so instanceof Animation fails.","solutions":["Pass the actual gsap.timeline()/gsap.to() instance to `animation:` in GSDevTools.create()","If using a string, set `gsap.timeline({id: \"myId\"})` and pass exactly that id string","Create the animation before GSDevTools.create(), or pass a function/later reference supported by your version","Ensure only one copy of gsap is loaded so instanceof checks pass"],"exampleFix":"// before\nGSDevTools.create({ animation: \"myTween \" }); // typo, id not found -> undefined\n// after\ngsap.timeline({ id: \"myTween\" }).to(\".box\", {x: 100});\nGSDevTools.create({ animation: \"myTween\" });","handlingStrategy":"type-guard","validationCode":"const anim = typeof id === 'string' ? gsap.getById(id) : id;\nif (!anim || typeof anim.play !== 'function' || !(anim instanceof gsap.core.Animation)) {\n  throw new Error('GSDevTools: animation must be a GSAP Animation instance or registered id');\n}","typeGuard":"function isGSAPAnimation(a) {\n  return a instanceof gsap.core.Animation || (a && typeof a.play === 'function' && typeof a.progress === 'function');\n}","tryCatchPattern":null,"preventionTips":["Create animations before GSDevTools.create()","Use gsap.getById() to verify string ids resolve","Avoid loading duplicate gsap copies","Avoid ScrollTrigger-based animations with GSDevTools scrubber"],"tags":["gsap","gsdevtools","invalid-argument","animation"],"backgroundTag":"invalid-animation-reference","analyzedSha":"13e2b790546426a1a2e0e9b409f3f8dc6d6611f2","analyzedAt":"2026-08-29T08:34:05.027Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}