{"record":{"id":"12eae5a766d0d8d6","repo":"stride3d/stride","slug":"unable-to-parse-input","errorCode":null,"errorMessage":"Unable to parse input","messagePattern":"Unable to parse input","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializers/TagTypeSerializer.cs","lineNumber":62,"sourceCode":"// SOFTWARE.\n\nusing System;\nusing System.Collections.Generic;\nusing Stride.Core.Reflection;\nusing Stride.Core.Yaml.Events;\n\nnamespace Stride.Core.Yaml.Serialization.Serializers\n{\n    internal class TagTypeSerializer : ChainedSerializer\n    {\n        public override object ReadYaml(ref ObjectContext objectContext)\n        {\n            var parsingEvent = objectContext.Reader.Peek<ParsingEvent>();\n            // Can this happen here?\n            if (parsingEvent == null)\n            {\n                // TODO check how to put a location in this case?\n                throw new YamlException(\"Unable to parse input\");\n            }\n\n            var node = parsingEvent as NodeEvent;\n            if (node == null)\n            {\n                throw new YamlException(parsingEvent.Start, parsingEvent.End, $\"Unexpected parsing event found [{parsingEvent}]. Expecting Scalar, Mapping or Sequence\");\n            }\n\n            var type = objectContext.Descriptor != null ? objectContext.Descriptor.Type : null;\n\n            // Tries to get a Type from the TagTypes\n            Type typeFromTag = null;\n            if (!string.IsNullOrEmpty(node.Tag))\n            {\n                bool remapped;\n                typeFromTag = objectContext.SerializerContext.TypeFromTag(node.Tag, out remapped);\n                if (typeFromTag == null)\n                {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializers/TagTypeSerializer.cs#L44-L80","documentation":"TagTypeSerializer.ReadYaml throws this when it peeks the next parsing event and gets null, meaning the reader has no event available to process. Because there is no event, no start/end location can be attached to the YamlException.","triggerScenarios":"Calling ReadYaml on an exhausted/empty event stream; feeding an empty document to the deserializer; a corrupted or truncated YAML stream where the reader reaches EOF before a node event.","commonSituations":"Empty config files passed to a deserializer; truncated YAML from a failed download or interrupted write; calling the serializer pipeline on a reader positioned past the end of input.","solutions":["Ensure the YAML input is a non-empty, well-formed document before deserializing.","Check file/stream length and read the text first to fail early on empty input.","Validate the YAML parses (e.g. with a parser round-trip) before handing it to this serializer.","Fix the upstream producer that truncated the stream."],"exampleFix":"// before\nusing var reader = new StreamReader(path); // file may be empty\nvar obj = serializer.Deserialize(reader);\n// after\nvar text = File.ReadAllText(path);\nif (string.IsNullOrWhiteSpace(text)) throw new InvalidDataException($\"YAML file '{path}' is empty\");\nvar obj = serializer.Deserialize(new StringReader(text));","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(yamlInput)) throw new InvalidDataException(\"YAML input is empty; nothing to deserialize\");","typeGuard":null,"tryCatchPattern":"try { return serializer.Deserialize(reader); } catch (YamlException ex) when (ex.Message == \"Unable to parse input\") { throw new InvalidDataException(\"YAML stream was empty or exhausted before a node was read\", ex); }","preventionTips":["Check files are non-empty and fully written before deserializing.","Validate download/write completion (flush, temp-file rename) before parsing.","Fail early on blank config files with a clear message."],"tags":["yaml","deserialization","empty-input","parse"],"backgroundTag":"yaml-parse-error","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"}