SixLabors/ImageSharp · error · InvalidIccProfileException

Invalid Entry.

Error message

Invalid Entry.

What it means

In TrcCalculator's constructor, each tag entry must be either an IccCurveTagDataEntry ('curv') or IccParametricCurveTagDataEntry ('para'); anything else throws InvalidIccProfileException("Invalid Entry."). The profile supplied a tone-curve tag of an unsupported entry type where a curve was required.

Solutions

  1. Re-export the profile from a trusted tool so TRC tags contain curv/para data.
  2. Inspect the profile's tag table (e.g. with a profile inspector) and fix or drop the offending TRC tag.
  3. Pre-validate TRC tag entry types before conversion and reject invalid profiles.
Defensive patterns

Strategy: try-catch

Type guard

static bool IsCurveEntry(IccTagDataEntry e) => e is IccCurveTagDataEntry or IccParametricCurveTagDataEntry;

Try / catch

try { converter.Convert(...); }
catch (InvalidIccProfileException ex) when (ex.Message == "Invalid Entry.") { logger.LogWarning(ex, "Profile TRC tag is not a curve entry"); /* reject profile */ }

Prevention

When it happens

Trigger: Converting with a profile whose rTRC/gTRC/bTRC or similar TRC tags contain non-curve data (e.g. mis-typed tag data or a text/descriptor entry stored under a TRC signature).

Common situations: Corrupt or forged ICC profiles; tag data whose embedded type signature disagrees with the tag's declared purpose; profiles assembled by broken tooling.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13). Data as JSON: /api/errors/c3e089d051a121d8. Report an issue: GitHub.

Appendix: source

Thrown at src/ImageSharp/ColorProfiles/Icc/Calculators/TrcCalculator.cs:30

{
    private readonly ISingleCalculator[] calculators;

    public TrcCalculator(IccTagDataEntry[] entries, bool inverted)
    {
        Guard.NotNull(entries, nameof(entries));
        if (entries.Length > 4)
        {
            throw new InvalidIccProfileException("ICC conversion supports at most four tone response curves.");
        }

        this.calculators = new ISingleCalculator[entries.Length];
        for (int i = 0; i < entries.Length; i++)
        {
            this.calculators[i] = entries[i] switch
            {
                IccCurveTagDataEntry curve => new CurveCalculator(curve, inverted),
                IccParametricCurveTagDataEntry parametricCurve => new ParametricCurveCalculator(parametricCurve, inverted),
                _ => throw new InvalidIccProfileException("Invalid Entry."),
            };
        }
    }

    public unsafe Vector4 Calculate(Vector4 value)
    {
        ref float f = ref Unsafe.As<Vector4, float>(ref value);
        for (int i = 0; i < this.calculators.Length; i++)
        {
            Unsafe.Add(ref f, i) = this.calculators[i].Calculate(Unsafe.Add(ref f, i));
        }

        return value;
    }
}

View on GitHub (pinned to 59ce6af6fc)