{"record":{"id":"79b533707165a298","repo":"stride3d/stride","slug":"unable-to-decode-asset-reference-0-expecting-format-guid","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/AssetReferenceSerializer.cs","lineNumber":26,"sourceCode":"\nnamespace Stride.Core.Assets.Serializers;\n\n/// <summary>\n/// A Yaml serializer for <see cref=\"AssetReference\"/>\n/// </summary>\n[YamlSerializerFactory(YamlAssetProfile.Name)]\ninternal class AssetReferenceSerializer : AssetScalarSerializerBase\n{\n    public override bool CanVisit(Type type)\n    {\n        return typeof(AssetReference).IsAssignableFrom(type);\n    }\n\n    public override object ConvertFrom(ref ObjectContext context, Scalar fromScalar)\n    {\n        if (!AssetReference.TryParse(fromScalar.Value, out var id, 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        return AssetReference.New(id, new UFile(ReferenceSerializationHelper.RestoreLocation(ref context, location.FullPath)));\n    }\n\n    public override string ConvertTo(ref ObjectContext objectContext)\n    {\n        var assetReference = (AssetReference)objectContext.Instance;\n        return ReferenceSerializationHelper.FormatReference(ref objectContext, assetReference.Id, assetReference.Location);\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":37,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Serializers/AssetReferenceSerializer.cs#L8-L37","documentation":"AssetReferenceSerializer.ConvertFrom deserializes a YAML scalar into an AssetReference. The scalar must be in the 'GUID:LOCATION' form (e.g. '2b4c...:MyAsset'), which it validates via AssetReference.TryParse. When the scalar does not match that format, a YamlException is thrown pointing at the offending scalar range.","triggerScenarios":"Loading a YAML asset whose AssetReference field value is not 'GUID:LOCATION' — missing colon, missing guid, an empty value, or a location containing an unexpected separator layout; hand-editing asset files or importing them from other formats.","commonSituations":"Manual YAML edits that dropped the guid part; assets migrated from another engine with plain path references; a tool that serialized the reference with the wrong format; corrupted asset files after merge conflicts.","solutions":["Fix the YAML value to the full 'GUID:LOCATION' format, using the asset's actual ItemId and its project-relative location.","Re-export or resave the asset in the Stride editor so the reference is serialized correctly.","Run AssetReference.TryParse on suspect values in a validation pass before loading the asset to pinpoint bad entries.","Check git merge conflicts on the asset file — a partially merged reference line is a common corruption source."],"exampleFix":"// before (YAML)\nReference: \"MyAsset\"\n\n// after (YAML)\nReference: \"10b4d2cb-987f-4c2f-a1a3-2d0e0a44a5c8:MyAsset\"","handlingStrategy":"validation","validationCode":"if (!AssetReference.TryParse(rawValue, out var id, out var location))\n    Console.WriteLine($\"Malformed asset reference: {rawValue}\");","typeGuard":"bool IsValidAssetReference(string s) => AssetReference.TryParse(s, out _, out _);","tryCatchPattern":"try { return serializer.ConvertFrom(ref context, scalar); }\ncatch (YamlException ex) { log.Error($\"Bad asset reference at {ex.Location}: {scalar.Value}\"); throw; }","preventionTips":["Never hand-edit asset reference YAML values","Run AssetReference.TryParse over references in a pre-load validation pass","Resolve git merge conflicts in asset files by re-saving in the editor","Generate references with tooling that emits GUID:LOCATION"],"tags":["yaml","serialization","asset-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"}