stride3d/stride · error · YamlException
ex.Message
Error message
ex.Message
What it means
ArraySerializer.ReadYaml wraps element deserialization: any exception thrown while reading the array is unwrapped of its aggregate layers (ex.Unwrap()) and rethrown as a YamlException tied to the YAML node's start/end marks, so the original message appears wrapped with source location.
Solutions
- Inspect ex.InnerException / the unwrapped message plus the YAML marks to find the failing element and fix its value or the element's declared type
- Validate the YAML data against the expected element type before deserialization
- Catch YamlException in your loading code and log the Start/End location for diagnosis
Example fix
// before values: - 1.0 - abc # not a float // after values: - 1.0 - 2.0
Defensive patterns
Strategy: try-catch
Try / catch
try { return serializer.Deserialize(reader, arrayType); } catch (YamlException ex) { Log.Error(ex, "Array element failed at {Start}-{End}: {Message}", ex.Start, ex.End, ex.InnerException?.Message ?? ex.Message); throw; } Prevention
- Validate scalar values match the element type before deserialization
- Log InnerException — the root cause message is unwrapped into the YamlException
- Pin element type expectations when upgrading library versions
When it happens
Trigger: Any inner element of a YAML sequence fails to deserialize (bad scalar format, type mismatch, nested error), causing the generic catch to convert it into a YamlException at the array node.
Common situations: A value like "abc" inside a float[] sequence; nested conversion failures after version upgrades changed element types; large arrays where it's unclear which element failed.
Related errors
- The given container does not match the expected type.
- ex.Message
- ex.Message
- Multiple identifiable objects with the same id
- Unable to decode asset part reference
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/25e36f52176f8f1f.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Yaml/Serialization/Serializers/ArraySerializer.cs:144
}
private static object ReadYaml(SerializerContext context, Type expectedType)
{
var node = context.Reader.Parser.Current;
try
{
var objectContext = new ObjectContext(context, null, context.FindTypeDescriptor(expectedType));
// TODO: we should go through the ObjectSerializerBackend, not directly use the ObjectSerializer!
return context.Serializer.ObjectSerializer.ReadYaml(ref objectContext);
}
catch (YamlException)
{
throw;
}
catch (Exception ex)
{
ex = ex.Unwrap();
throw new YamlException(node, ex);
}
}
private static void WriteYaml(SerializerContext context, object value, Type expectedType)
{
var objectContext = new ObjectContext(context, value, context.FindTypeDescriptor(expectedType));
// TODO: we should go through the ObjectSerializerBackend, not directly use the ObjectSerializer!
context.Serializer.ObjectSerializer.WriteYaml(ref objectContext);
}
}
}
View on GitHub (pinned to 96fad776d2)