AvaloniaUI/Avalonia · error · FormatException
Too many provided values.
Error message
Too many provided values.
What it means
Thrown inside TransformParser.ParseCommaDelimitedValues when the number of comma-separated values in a transform function argument list exceeds the capacity of the output span (outValues). Each transform function expects a fixed maximum number of arguments; supplying more than that triggers this FormatException.
Source
Thrown at src/Avalonia.Base/Media/Transformation/TransformParser.cs:157
rightValue = ParseValue(rightPart);
return 2;
}
leftValue = ParseValue(part);
return 1;
}
static int ParseCommaDelimitedValues(ReadOnlySpan<char> part, in Span<UnitValue> outValues)
{
int valueIndex = 0;
while (true)
{
if (valueIndex >= outValues.Length)
{
throw new FormatException("Too many provided values.");
}
var commaIndex = part.IndexOf(',');
if (commaIndex == -1)
{
if (!part.IsWhiteSpace())
{
outValues[valueIndex++] = ParseValue(part);
}
break;
}
var valuePart = part.Slice(0, commaIndex).Trim();
outValues[valueIndex++] = ParseValue(valuePart);
View on GitHub (pinned to 11c5427268)
Solutions
- Check the expected argument count for the transform function and remove extras.
- Refer to the function's documented value count (reported separately via error 327) to match the call.
- If a 3D transform is needed, confirm the platform/build supports it or use the appropriate 3D-capable API.
Example fix
// before
var t = TransformOperations.Parse("translate(10px, 20px, 30px)"); // too many values
// after
var t = TransformOperations.Parse("translate(10px, 20px)"); Defensive patterns
Strategy: validation
Try / catch
try { return TransformOperations.Parse(s); }
catch (FormatException) { /* fix arg count and retry */ } Prevention
- Match the number of comma-delimited arguments to each function's expected count.
- Avoid 3D transform syntax in 2D-only contexts.
- Cross-check argument counts against the function documentation.
When it happens
Trigger: Providing a transform function with too many comma-delimited arguments, e.g. translate(10px, 20px, 30px) when the function only accepts two. The parser iterates values and, once valueIndex reaches outValues.Length, it throws 'Too many provided values.'
Common situations: Hand-authored CSS/XAML transforms with extra arguments; copy-pasting a 3D transform (translate3d, scale3d) into a 2D-only context; misunderstanding the argument count a given function accepts.
Related errors
- Invalid format. {function} expects {count} value(s).
- Invalid transform string: '{s}'.
- Invalid value {value.Value} {unitString} for {function}
- Invalid unit: {part.ToString()}
- Invalid text trimming string: '{s}'.
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/060d828d57925cfc.
Report an issue: GitHub.