plotly/plotly.js · error

Contour data invalid for the specified inequality range oper

Error message

Contour data invalid for the specified inequality range operation.

What it means

Guard in convert_to_constraints for the '][' (and '[]') range inequality operations. These operations require pathinfo entries representing the two boundary contours of the range; the code manipulates/reverses the first pathinfo's paths and starts, and throws when the structure (number of pathinfo levels for the given range) is not what the range operation expects — i.e. the extracted contour data cannot express the requested inequality band.

Source

Thrown at src/traces/contour/convert_to_constraints.js:50

            }
            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 '][':
            var tmp = op0;
            op0 = op1;
            op1 = tmp;
            // It's a nice rule, except this definitely *is* what's intended here.
            /* eslint-disable: no-fallthrough */
        case '[]':
            /* eslint-enable: no-fallthrough */
            if(pathinfo.length !== 2) {
                Lib.warn('Contour data invalid for the specified inequality range operation.');
            }

            // In this case there should be exactly two contour levels in pathinfo.
            // - We concatenate the info into one pathinfo.
            // - We must also flip all of the data in the `[]` case.
            // This will draw the contours as closed.
            pi0 = copyPathinfo(pathinfo[0]);
            pi1 = copyPathinfo(pathinfo[1]);

            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]);
            }

View on GitHub (pinned to 1d090e0b5f)

Solutions

  1. Verify contours.start/end/size define a proper band for '][' or '[]' operations.
  2. Ensure the z data actually crosses both range boundary levels so two boundary contours exist.
  3. Adjust the operation (e.g. use '<' or '>' with a single level) if a band is not intended.
  4. Validate the constraint trace's contours settings against the data range.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/traces/contour/convert_to_constraints.js:50 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/3f715ce70ac74b42. Report an issue: GitHub.