{"record":{"id":"6677df7b66fe6cda","repo":"SixLabors/ImageSharp","slug":"invalid-calculation-type-lutabcalculator","errorCode":null,"errorMessage":"Invalid calculation type","messagePattern":"Invalid calculation type","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs","lineNumber":110,"sourceCode":"                if (this.curveMCalculator != null)\n                {\n                    value = this.curveMCalculator.Calculate(value);\n                }\n\n                if (this.clutCalculator != null)\n                {\n                    value = this.clutCalculator.Calculate(value);\n                }\n\n                if (this.curveACalculator != null)\n                {\n                    value = this.curveACalculator.Calculate(value);\n                }\n\n                return value;\n\n            default:\n                throw new InvalidOperationException(\"Invalid calculation type\");\n        }\n    }\n\n    /// <summary>\n    /// Creates calculators for the processing stages present in the LUT entry.\n    /// </summary>\n    /// <remarks>\n    /// The tag entry classes already validate channel continuity, so this method only materializes the available stages.\n    /// </remarks>\n    private void Init(IccTagDataEntry[] curveA, IccTagDataEntry[] curveB, IccTagDataEntry[] curveM, Vector3? matrix3x1, Matrix4x4? matrix3x3, IccClut clut)\n    {\n        bool hasACurve = curveA != null;\n        bool hasBCurve = curveB != null;\n        bool hasMCurve = curveM != null;\n        bool hasMatrix = matrix3x1 != null && matrix3x3 != null;\n        bool hasClut = clut != null;\n\n        Guard.IsTrue(","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs#L92-L128","documentation":"LutABCalculator.Calculate switches over the LUT A-to-B / B-to-A processing layout type; the default arm throws InvalidOperationException(\"Invalid calculation type\") when the entry's layout is not one of the supported LutAB layouts. This indicates the calculator was built from a LutAB entry whose class/type is unrecognized.","triggerScenarios":"Calling Calculate (e.g. via the result path) on a LutABCalculator whose IccLutAtoBTagDataEntry has a ProcessElements/layout combination not handled during construction, leaving the layout switch with no matching case.","commonSituations":"ICC profiles containing non-standard or corrupted luta/btoA tag data whose class byte is out of the ICC-spec set; hand-edited profiles; library bug if a new ICC profile class wasn't mapped.","solutions":["Re-export or replace the ICC profile using a standard tool so the lutA/BToB tags use standard classes (mBA, mAB, clut-only).","Validate profile tags before conversion and skip/reject profiles with unknown LutAB classes.","If the profile looks valid, report it as a library bug with the profile attached."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { converter.Convert(...); }\ncatch (InvalidIccProfileException ex) { logger.LogWarning(ex, \"Profile has unsupported LutAB layout\"); /* reject or re-export profile */ }","preventionTips":["Pre-inspect profile lutAToB/bToATags with a profile inspector before production use.","Reject profiles whose LutAB tag class is outside the ICC-standard set.","Keep the ImageSharp package updated so newly recognized profile classes are handled."],"tags":["icc","color-management","profile-validation","csharp"],"backgroundTag":"schema-validation-failed","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}