{"record":{"id":"5a499f21f1cff8d7","repo":"microsoft/semantic-kernel","slug":"unknown-condition-type-condition-type","errorCode":null,"errorMessage":"Unknown condition type: {condition.Type}","messagePattern":"Unknown condition type: (.+?)","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessAgentBuilder.cs","lineNumber":314,"sourceCode":"                    this.EvalHandlers.Add(new DeclarativeEventHandlerBuilder(condition));\n                }\n                else if (condition.Type == DeclarativeProcessConditionType.Always)\n                {\n                    if (this.DefaultHandler is not null)\n                    {\n                        throw new KernelException(\"Only one `Always` handler is allowed in a group of event handlers.\");\n                    }\n\n                    if (!string.IsNullOrWhiteSpace(condition.Expression))\n                    {\n                        throw new KernelException(\"`Always` handlers must not have an eval expression.\");\n                    }\n\n                    this.AlwaysHandler = new DeclarativeEventHandlerBuilder(condition);\n                }\n                else\n                {\n                    throw new KernelException($\"Unknown condition type: {condition.Type}\");\n                }\n            }\n        }\n    }\n\n    /// <summary>\n    /// The list of semantic handlers for this group of event handlers.\n    /// </summary>\n    public DeclarativeEventHandlerBuilder? AlwaysHandler { get; init; }\n\n    /// <summary>\n    /// The optional default handler for this group of event handlers.\n    /// </summary>\n    public DeclarativeEventHandlerBuilder? DefaultHandler { get; set; }\n\n    /// <summary>\n    /// The list of state based handlers for this group of event handlers.\n    /// </summary>","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessAgentBuilder.cs#L296-L332","documentation":"Thrown by DeclarativeEventHandlerGroupBuilder constructor when a DeclarativeProcessCondition's Type is not one of the recognized enum values: Default, Eval, or Always. This indicates either an out-of-range enum value, an undefined enum cast from an integer, or a future/unmapped condition type.","triggerScenarios":"Passing a DeclarativeProcessCondition whose Type is an unexpected enum value (e.g., cast from an invalid integer, or a newly added enum member not yet handled by the builder). This commonly occurs when deserializing YAML/JSON with a misspelled or unsupported condition type string.","commonSituations":"YAML/JSON declarative process definition with a typo in the condition type field. Using a condition type from a newer SK version that this builder does not yet recognize. Casting an arbitrary integer to DeclarativeProcessConditionType producing an undefined enum member.","solutions":["Check the condition.Type value in the error message and correct it to one of: Default, Eval, or Always.","Validate condition type strings during YAML/JSON parsing before passing to the builder.","Upgrade to a version of the Process package that supports the condition type if it is a legitimate new type."],"exampleFix":"// before — typo in YAML condition type\n// conditions:\n//   - type: Defualt   # misspelled\n\n// after\n// conditions:\n//   - type: Default","handlingStrategy":"validation","validationCode":"private static readonly HashSet<DeclarativeProcessConditionType> _validTypes = new()\n{\n    DeclarativeProcessConditionType.Default,\n    DeclarativeProcessConditionType.Eval,\n    DeclarativeProcessConditionType.Always\n};\n\npublic static bool IsValidConditionType(DeclarativeProcessConditionType type)\n    => _validTypes.Contains(type);","typeGuard":"public static bool IsValidConditionType(DeclarativeProcessConditionType type)\n    => Enum.IsDefined(typeof(DeclarativeProcessConditionType), type)\n       && (type == DeclarativeProcessConditionType.Default\n           || type == DeclarativeProcessConditionType.Eval\n           || type == DeclarativeProcessConditionType.Always);","tryCatchPattern":null,"preventionTips":["Validate condition type strings during YAML/JSON deserialization.","Ensure only Default, Eval, or Always types are used.","Guard against integer-to-enum casts that produce undefined members."],"tags":["semantic-kernel","process-framework","declarative","event-handlers","enum","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}