{"record":{"id":"065bc49551ec46e5","repo":"plotly/plotly.js","slug":"computeframe-must-be-given-a-string-frame-name","errorCode":null,"errorMessage":"computeFrame must be given a string frame name","messagePattern":"computeFrame must be given a string frame name","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/plots/plots.js","lineNumber":2081,"sourceCode":" * @param {object} frameLookup\n *      An object containing frames keyed by name (i.e. gd._transitionData._frameHash)\n * @param {string} frame\n *      The name of the keyframe to be computed\n *\n * Returns: a new object with the merged content\n */\nplots.computeFrame = function(gd, frameName) {\n    var frameLookup = gd._transitionData._frameHash;\n    var i, traceIndices, traceIndex, destIndex;\n\n    // Null or undefined will fail on .toString(). We'll allow numbers since we\n    // make it clear frames must be given string names, but we'll allow numbers\n    // here since they're otherwise fine for looking up frames as long as they're\n    // properly cast to strings. We really just want to ensure here that this\n    // 1) doesn't fail, and\n    // 2) doens't give an incorrect answer (which String(frameName) would)\n    if(!frameName) {\n        throw new Error('computeFrame must be given a string frame name');\n    }\n\n    var framePtr = frameLookup[frameName.toString()];\n\n    // Return false if the name is invalid:\n    if(!framePtr) {\n        return false;\n    }\n\n    var frameStack = [framePtr];\n    var frameNameStack = [framePtr.name];\n\n    // Follow frame pointers:\n    while(framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) {\n        // Avoid infinite loops:\n        if(frameNameStack.indexOf(framePtr.name) !== -1) break;\n\n        frameStack.push(framePtr);","sourceCodeStart":2063,"sourceCodeEnd":2099,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/plots/plots.js#L2063-L2099","documentation":"Argument guard in plots.computeFrame, which merges a named keyframe from gd._transitionData._frameHash for animations. The frame name is used as a lookup key (and eventually .toString()'d), so null/undefined would crash downstream and objects would silently look up wrong keys. The throw fires when frameName is not a string (or number); note the code deliberately tolerates numbers since they stringify cleanly, but other types are rejected.","triggerScenarios":"Thrown at src/plots/plots.js:2081 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the frame name as a string, e.g. Plotly.animate(gd, 'frameName', ...).","Coerce with String(frameName) before calling, if the value originates from user input.","Check that the frame was registered via Plotly.addFrames with a string 'name'."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314","analyzedAt":"2026-09-02T22:03:39.906Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}