{"record":{"id":"fb0e1ff9bb060e36","repo":"SixLabors/ImageSharp","slug":"invalid-multiprocesselement-type-of-value-signature","errorCode":null,"errorMessage":"Invalid MultiProcessElement type of {value.Signature}","messagePattern":"Invalid MultiProcessElement type of (.+?)","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs","lineNumber":36,"sourceCode":"        int count = this.WriteUInt32((uint)value.Signature);\n        count += this.WriteUInt16((ushort)value.InputChannelCount);\n        count += this.WriteUInt16((ushort)value.OutputChannelCount);\n\n        switch (value.Signature)\n        {\n            case IccMultiProcessElementSignature.CurveSet:\n                return count + this.WriteCurveSetProcessElement((IccCurveSetProcessElement)value);\n            case IccMultiProcessElementSignature.Matrix:\n                return count + this.WriteMatrixProcessElement((IccMatrixProcessElement)value);\n            case IccMultiProcessElementSignature.Clut:\n                return count + this.WriteClutProcessElement((IccClutProcessElement)value);\n\n            case IccMultiProcessElementSignature.BAcs:\n            case IccMultiProcessElementSignature.EAcs:\n                return count + this.WriteEmpty(8);\n\n            default:\n                throw new InvalidIccProfileException($\"Invalid MultiProcessElement type of {value.Signature}\");\n        }\n    }\n\n    /// <summary>\n    /// Writes a CurveSet <see cref=\"IccMultiProcessElement\"/>\n    /// </summary>\n    /// <param name=\"value\">The element to write</param>\n    /// <returns>The number of bytes written</returns>\n    public int WriteCurveSetProcessElement(IccCurveSetProcessElement value)\n    {\n        int count = 0;\n        foreach (IccOneDimensionalCurve curve in value.Curves)\n        {\n            count += this.WriteOneDimensionalCurve(curve);\n            count += this.WritePadding();\n        }\n\n        return count;","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs#L18-L54","documentation":"When writing a multiProcessElement, the writer switches on the element's Signature to pick the serialization routine. Signatures outside the implemented set (curveSet, clut, matrix, bAcs, eAcs, etc.) have no writer implementation and cause this throw. Notably this is a writer-side limitation: valid ICC MPE types the library cannot yet serialize still fail.","triggerScenarios":"Calling IccDataWriter.WriteMultiProcessElement (directly or via size()/WriteMultiProcessElementsTagDataEntry) with an IccMultiProcessElement whose Signature is a valid-ICC but unimplemented type, or an invalid/corrupt signature read from another profile.","commonSituations":"Round-tripping ICC profiles: reading an mAB/mBA tag containing a newer MPE type (unsupported on read or default-initialized), then writing the profile back out; programmatic profile generation with the wrong element type.","solutions":["Use only MPE types the library implements (setCurve, clut, matrix, bAcs, eAcs) when authoring profiles.","Upgrade ImageSharp - newer versions support more MPE signatures.","Replace or drop unsupported elements from the profile before re-serializing.","Catch InvalidIccProfileException during profile save and skip/error out for that profile."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the element signature is one the writer implements before serializing\nstatic bool IsWritable(IccMultiProcessElement e) =>\n    e.Signature is IccMultiProcessElementSignature.CurveSet or\n      IccMultiProcessElementSignature.Clut or\n      IccMultiProcessElementSignature.Matrix or\n      IccMultiProcessElementSignature.BAcs or\n      IccMultiProcessElementSignature.EAcs;","typeGuard":null,"tryCatchPattern":"try { writer.WriteMultiProcessElement(element); }\ncatch (InvalidIccProfileException ex) when (ex.Message.Contains(\"MultiProcessElement\"))\n{\n    logger.LogWarning(ex, \"Skipping unwritable MPE type {Sig}\", element.Signature);\n}","preventionTips":["Author profiles only with implemented MPE types","Upgrade ImageSharp before round-tripping newer profiles","Strip unsupported elements from profiles before saving","Test profile save/load round-trips in CI with representative profiles"],"tags":["icc","serialization","multiprocess-element"],"backgroundTag":"unsupported-enum-value","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"}