{"record":{"id":"3e2298c4a2605dad","repo":"stride3d/stride","slug":"unable-to-decode-asset-reference-0-expecting-format-guid-3e2298","errorCode":null,"errorMessage":"Unable to decode asset reference [{0}]. Expecting format GUID:LOCATION","messagePattern":"Unable to decode asset reference \\[(.+?)\\]\\. Expecting format GUID:LOCATION","errorType":"validation","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/Serializers/ContentReferenceSerializer.cs","lineNumber":25,"sourceCode":"using Stride.Core.Yaml.Serialization;\n\nnamespace Stride.Core.Assets.Serializers;\n\n[YamlSerializerFactory(YamlAssetProfile.Name)]\npublic class ContentReferenceSerializer : AssetScalarSerializerBase\n{\n    public static readonly ContentReferenceSerializer Default = new();\n\n    public override bool CanVisit(Type type)\n    {\n        return AssetRegistry.IsExactContentType(type);\n    }\n\n    public override object ConvertFrom(ref ObjectContext context, Scalar fromScalar)\n    {\n        if (!AssetReference.TryParse(fromScalar.Value, out var guid, out var location))\n        {\n            throw new YamlException(fromScalar.Start, fromScalar.End, \"Unable to decode asset reference [{0}]. Expecting format GUID:LOCATION\".ToFormat(fromScalar.Value));\n        }\n\n        var instance = AttachedReferenceManager.CreateProxyObject(context.Descriptor.Type, guid, ReferenceSerializationHelper.RestoreLocation(ref context, location.FullPath));\n        return instance;\n    }\n\n    public override string ConvertTo(ref ObjectContext objectContext)\n    {\n        var attachedReference = AttachedReferenceManager.GetAttachedReference(objectContext.Instance)\n            ?? throw new YamlException($\"Unable to extract asset reference from object [{objectContext.Instance}]\");\n        return ReferenceSerializationHelper.FormatReference(ref objectContext, attachedReference.Id, attachedReference.Url);\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":39,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Serializers/ContentReferenceSerializer.cs#L7-L39","documentation":"ContentReferenceSerializer.ConvertFrom deserializes a YAML scalar into a proxy object for a content/asset reference (via AttachedReferenceManager.CreateProxyObject). Like the AssetReference serializer it requires the 'GUID:LOCATION' format, validated by AssetReference.TryParse, and throws YamlException with the scalar's source range when the format is wrong.","triggerScenarios":"Loading YAML containing a content-reference field whose value lacks the 'GUID:LOCATION' structure — no guid, no colon separator, empty scalar, or a URL-only reference; the field type does not match AssetReference.TryParse's expectations.","commonSituations":"Hand-edited or merge-conflicted asset files; references created by custom tooling that wrote only the URL; loading assets produced by an older or newer serialization format.","solutions":["Correct the YAML scalar to 'GUID:LOCATION' with the referenced content's ItemId and location.","Resave/re-export the referencing asset through the Stride editor to regenerate well-formed references.","Validate the raw string with AssetReference.TryParse before/during load to identify all malformed fields.","Compare with a known-good version of the asset file (git history) to restore the missing guid or location."],"exampleFix":"// before (YAML)\nTexture: \"background.png\"\n\n// after (YAML)\nTexture: \"9f3a1c2e-11d2-4a55-b7aa-01c93f5e6d7b:background\"","handlingStrategy":"validation","validationCode":"if (!AssetReference.TryParse(scalarValue, out var guid, out var location))\n    Console.WriteLine($\"Malformed content reference: {scalarValue}\");","typeGuard":"bool IsValidContentReference(string s) => AssetReference.TryParse(s, out _, out _);","tryCatchPattern":"try { return serializer.ConvertFrom(ref context, scalar); }\ncatch (YamlException ex) { log.Error($\"Malformed content reference '{scalar.Value}' at {ex.Location}\"); throw; }","preventionTips":["Keep references in GUID:LOCATION form produced by the editor","Validate YAML reference fields before deserialization","Re-export assets after migrations from other formats","Diff asset files against git history when load fails"],"tags":["yaml","serialization","content-reference","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}