SixLabors/ImageSharp · error · InvalidIccProfileException
Entry is null.
Error message
Entry is null.
What it means
Thrown by IccConverterBase.InitD when the D2B/B2D tag's data entry cannot be cast to IccMultiProcessElementsTagDataEntry (GetTag<T> returned null), meaning the tag is absent or holds a different entry type. InitD only supports multi-process elements, so a missing entry aborts profile initialization.
Solutions
- Ensure the profile actually contains D2B0/B2D0 tags with IccMultiProcessElementsTagDataEntry entries before selecting this conversion path.
- Use a profile that routes through the A2B (InitA) LUT path instead of the D2B multi-process path.
- Catch InvalidIccProfileException during converter construction and fall back to a supported profile.
Example fix
// before: passing a profile whose D2B0 tag is missing
var converter = new IccConverter(profile);
// after: verify the tag entry type first
if (profile.Tags.TryGetValue(IccProfileTag.D2B0, out var entry) && entry is IccMultiProcessElementsTagDataEntry)
{
var converter = new IccConverter(profile);
} Defensive patterns
Strategy: validation
Validate before calling
bool hasMpe = profile.Tags.TryGetValue(IccProfileTag.D2B0, out var e)
&& e is IccMultiProcessElementsTagDataEntry;
if (!hasMpe) { /* choose the A2B path or a different profile */ } Type guard
if (profile.Tags.TryGetValue(IccProfileTag.D2B0, out var entry)
&& entry is IccMultiProcessElementsTagDataEntry mpe) { /* safe to use D2B path */ } Prevention
- Check for D2B0/B2D0 tags before selecting the D2B conversion path.
- Route LUT-based v4 profiles through the A2B path instead.
- Validate profiles at load time with a small tag-presence check.
When it happens
Trigger: Initializing a converter path that calls InitD (the D2B/B2D pipeline) for a profile where the D2Bx/B2Dx tag is missing entirely or contains a non-multiProcessElements entry (e.g. lut16).
Common situations: v4/v5 ICC profiles whose D2B tag was not written or was written as a legacy LUT entry; corrupt profile parsing that produced a different entry type for the tag.
Related errors
- Multi process elements are not supported
- Invalid entry .
- Missing matrix column or channel.
- Invalid parametric curve type of
- Invalid curve segment type of
AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13).
Data as JSON: /api/errors/257df701c2ce1f80.
Report an issue: GitHub.
Appendix: source
Thrown at src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs:69
ConversionMethod.ColorTrc => InitColorTrc(profile, toPcs),
ConversionMethod.GrayTrc => InitGrayTrc(profile, toPcs),
_ => throw new InvalidIccProfileException("Invalid conversion method."),
};
private static IVector4Calculator InitA(IccProfile profile, IccProfileTag tag)
=> GetTag(profile, tag) switch
{
IccLut8TagDataEntry lut8 => new LutEntryCalculator(lut8),
IccLut16TagDataEntry lut16 => new LutEntryCalculator(lut16),
IccLutAToBTagDataEntry lutAtoB => new LutABCalculator(lutAtoB),
IccLutBToATagDataEntry lutBtoA => new LutABCalculator(lutBtoA),
_ => throw new InvalidIccProfileException($"Invalid entry {tag}."),
};
private static IVector4Calculator InitD(IccProfile profile, IccProfileTag tag)
{
IccMultiProcessElementsTagDataEntry entry = GetTag<IccMultiProcessElementsTagDataEntry>(profile, tag)
?? throw new InvalidIccProfileException("Entry is null.");
throw new NotImplementedException("Multi process elements are not supported");
}
private static ColorTrcCalculator InitColorTrc(IccProfile profile, bool toPcs)
{
IccXyzTagDataEntry redMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.RedMatrixColumn);
IccXyzTagDataEntry greenMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.GreenMatrixColumn);
IccXyzTagDataEntry blueMatrixColumn = GetTag<IccXyzTagDataEntry>(profile, IccProfileTag.BlueMatrixColumn);
IccTagDataEntry redTrc = GetTag(profile, IccProfileTag.RedTrc);
IccTagDataEntry greenTrc = GetTag(profile, IccProfileTag.GreenTrc);
IccTagDataEntry blueTrc = GetTag(profile, IccProfileTag.BlueTrc);
if (redMatrixColumn == null ||
greenMatrixColumn == null ||
blueMatrixColumn == null ||
redTrc == null ||View on GitHub (pinned to 59ce6af6fc)