{"record":{"id":"528e22cc618352a2","repo":"plotly/plotly.js","slug":"export-format-is-not-values","errorCode":null,"errorMessage":"Export format is not ${values}.","messagePattern":"Export format is not (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/plot_api/to_image.js","lineNumber":111,"sourceCode":"    } else {\n        gd = Lib.getGraphDiv(gd);\n        data = Lib.extendDeep([], gd.data);\n        layout = Lib.extendDeep({}, gd.layout);\n        config = gd._context;\n        fullLayout = gd._fullLayout || {};\n    }\n\n    function isImpliedOrValid(attr) {\n        return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]);\n    }\n\n    if((!isImpliedOrValid('width') && opts.width !== null) ||\n        (!isImpliedOrValid('height') && opts.height !== null)) {\n        throw new Error('Height and width should be pixel values.');\n    }\n\n    if(!isImpliedOrValid('format')) {\n        throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.');\n    }\n\n    var fullOpts = {};\n\n    function coerce(attr, dflt) {\n        return Lib.coerce(opts, fullOpts, attrs, attr, dflt);\n    }\n\n    var format = coerce('format');\n    var width = coerce('width');\n    var height = coerce('height');\n    var scale = coerce('scale');\n    var setBackground = coerce('setBackground');\n    var imageDataOnly = coerce('imageDataOnly');\n\n    // put the cloned div somewhere off screen before attaching to DOM\n    var clonedGd = document.createElement('div');\n    clonedGd.style.position = 'absolute';","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/plotly/plotly.js/blob/1d090e0b5ffb8d0fdf6e0e4ff51d3f3cf67f1314/src/plot_api/to_image.js#L93-L129","documentation":"Validation guard in Plotly.toImage: opts.format is checked with Lib.validate against the format attribute, which only allows the enumerated values 'png', 'jpeg', 'webp', 'svg' and the legacy 'full-json'. The throw fires when a caller requests any other format string (e.g. 'jpg', 'pdf', 'gif'), which the rasterizer cannot produce.","triggerScenarios":"Thrown at src/plot_api/to_image.js:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported formats: 'png', 'jpeg', 'webp', 'svg' (or 'full-json').","Replace 'jpg' with 'jpeg'.","For unsupported formats like PDF, convert the PNG/SVG output externally.","Omit format to use the default ('png')."],"exampleFix":null,"handlingStrategy":"validation","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"}