{"record":{"id":"3f3762eebbd2147b","repo":"microsoft/semantic-kernel","slug":"failed-to-parse-schema","errorCode":null,"errorMessage":"Failed to parse schema.","messagePattern":"Failed to parse schema\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs","lineNumber":678,"sourceCode":"            .FirstOrDefault(node => node[\"id\"]?.ToString() == nodeId);\n\n        if (node is null || !node.Children.TryGetValue(\"inputs\", out YamlNode? inputs) || input is null || inputs is not YamlMappingNode inputMap)\n        {\n            throw new KernelException(\"Failed to deserialize workflow.\");\n        }\n\n        // This dance to convert the YamlMappingNode to a string and then back to a JsonSchema is rather inefficient, need to find a better option.\n        // Serialize the YamlMappingNode to a Yaml string\n        var serializer = new SerializerBuilder().Build();\n        string rawYaml = serializer.Serialize(inputMap);\n\n        // Deserialize the Yaml string to an object\n        var deserializer = new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance).Build();\n        var yamlObject = deserializer.Deserialize(rawYaml);\n\n        // Serialize the object to a JSON string\n        var jsonSchema = JsonSerializer.Serialize(yamlObject);\n        var jsonNode = JsonNode.Parse(jsonSchema) ?? throw new KernelException(\"Failed to parse schema.\");\n\n        var inputsDictionary = inputMap.Select(inputMap => new KeyValuePair<string, JsonNode>(inputMap.Key.ToString(), jsonNode))\n            .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);\n\n        return inputsDictionary;\n    }\n}\n","sourceCodeStart":660,"sourceCodeEnd":686,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs#L660-L686","documentation":"Thrown by `ExtractNodeInputs` when `JsonNode.Parse` on the JSON-serialized schema string returns null. This is the final step of the YAML->JSON schema conversion; a null parse indicates the intermediate JSON string was empty, null-equivalent, or malformed. It is a KernelException.","triggerScenarios":"An `inputs` mapping whose serialized form deserializes to an object that re-serializes to an empty/null JSON string; YAML content that collapses to nothing during the serialize/deserialize round-trip (e.g. a mapping containing only null-valued keys).","commonSituations":"Inputs with all-null values; YAML with anchors/aliases that resolve to empty; library version differences in how empty mappings are serialized; trailing corruption of the schema string.","solutions":["Ensure input values are non-null and serialize to non-empty JSON.","Inspect `rawYaml` and `jsonSchema` intermediate strings for the offending input to find where the content is lost.","Avoid YAML anchors/aliases or null-only mappings in `inputs`."],"exampleFix":"# before\ninputs:\n  message: null\n# after\ninputs:\n  message: \"hello\"","handlingStrategy":"try-catch","validationCode":"// Reject inputs whose values are all null before loading.\nforeach (var node in workflow.Nodes)\n{\n    if (node.Inputs is null) continue;\n    foreach (var k in node.Inputs.Keys)\n    {\n        if (node.Inputs[k] is null)\n            throw new InvalidOperationException($\"Node '{node.Id}' input '{k}' is null; cannot derive schema.\");\n    }\n}","typeGuard":"bool InputsAreNonNull(Node n) => n.Inputs?.All(kvp => kvp.Value is not null) ?? true;","tryCatchPattern":"try { var inputs = builder.ExtractNodeInputs(nodeId); }\ncatch (KernelException ex) when (ex.Message.Contains(\"Failed to parse schema\"))\n{ _logger.LogError(ex, \"Schema round-trip produced null JSON for node '{NodeId}'.\", nodeId); throw; }","preventionTips":["Avoid null-only or anchor/alias inputs in YAML.","Provide explicit, non-null values for every input."],"tags":["workflow","process-framework","yaml","json","serialization","schema"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}