plotly/plotly.js · error
Contour data invalid for the specified inequality operation.
Error message
Contour data invalid for the specified inequality operation.
What it means
Guard in convert_to_constraints, which reshapes contour pathinfo extracted by the marching-squares algorithm into path segments usable for inequality constraints (contours traces with constraints operations like '=', '<', '>', '<=', '>=', '[]', '][', '(', ')', '(', ')'). Depending on the operation, paths/starts must be reversed or the pathinfo must contain exactly the expected structure (e.g. two levels for range operations). The throw fires when the extracted contour data does not match what the requested inequality operation requires.
Source
Thrown at src/traces/contour/convert_to_constraints.js:23
// The contour extraction is great, except it totally fails for constraints because we
// need weird range loops and flipped contours instead of the usual format. This function
// does some weird manipulation of the extracted pathinfo data such that it magically
// draws contours correctly *as* constraints.
//
// ** I do not know which "weird range loops" the comment above is referring to.
module.exports = function(pathinfo, operation) {
var i, pi0, pi1;
var op0 = function(arr) { return arr.reverse(); };
var op1 = function(arr) { return arr; };
switch(operation) {
case '=':
case '<':
return pathinfo;
case '>':
if(pathinfo.length !== 1) {
Lib.warn('Contour data invalid for the specified inequality operation.');
}
// In this case there should be exactly one contour levels in pathinfo.
// We flip all of the data. This will draw the contour as closed.
pi0 = pathinfo[0];
for(i = 0; i < pi0.edgepaths.length; i++) {
pi0.edgepaths[i] = op0(pi0.edgepaths[i]);
}
for(i = 0; i < pi0.paths.length; i++) {
pi0.paths[i] = op0(pi0.paths[i]);
}
for(i = 0; i < pi0.starts.length; i++) {
pi0.starts[i] = op0(pi0.starts[i]);
}
return pathinfo;
case '][':View on GitHub (pinned to 1d090e0b5f)
Solutions
- Check the contours operation setting on the constraint trace; use a valid operation for the z data.
- Ensure the z data produces contours at the specified start/end/size levels (non-degenerate data).
- For range operations like '[]' or '][', verify start < end in contours settings.
- Report as a bug if the data is ordinary but the error still appears — it usually signals an internal pathinfo mismatch.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/traces/contour/convert_to_constraints.js:23 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of plotly/plotly.js@1d090e0b5f (2026-09-02).
Data as JSON: /api/errors/7580fe3579ea5bd9.
Report an issue: GitHub.