{"record":{"id":"0cb136cfe1f9f792","repo":"microsoft/semantic-kernel","slug":"at-least-one-action-must-be-provided","errorCode":null,"errorMessage":"At least one action must be provided.","messagePattern":"At least one action must be provided\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Abstractions/ProcessAgentActions.cs","lineNumber":29,"sourceCode":"[DataContract]\npublic sealed class ProcessAgentActions\n{\n    /// <summary>\n    /// Creates a new instance of the <see cref=\"ProcessAgentActions\"/> class.\n    /// </summary>\n    /// <param name=\"codeActions\">The code based actions. These are not serializable to a declarative format.</param>\n    /// <param name=\"declarativeActions\">The declarative action. These are required when building an exportable process.</param>\n    /// <exception cref=\"ArgumentException\"></exception>\n    public ProcessAgentActions(\n        ProcessAgentCodeActions? codeActions = null,\n        ProcessAgentDeclarativeActions? declarativeActions = null)\n    {\n        this.CodeActions = codeActions;\n        this.DeclarativeActions = declarativeActions;\n\n        if (codeActions == null && declarativeActions == null)\n        {\n            throw new ArgumentException(\"At least one action must be provided.\");\n        }\n    }\n\n    /// <summary>\n    /// The optional handler group for code-based actions.\n    /// </summary>\n    public ProcessAgentCodeActions? CodeActions { get; init; }\n\n    /// <summary>\n    /// The optional handler group for declarative actions.\n    /// </summary>\n    public ProcessAgentDeclarativeActions? DeclarativeActions { get; init; }\n}\n\n/// <summary>\n/// Represents the code-based actions that can be performed by a process agent.\n/// </summary>\npublic sealed class ProcessAgentCodeActions","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Abstractions/ProcessAgentActions.cs#L11-L47","documentation":"Thrown by the ProcessAgentActions constructor when both the codeActions and declarativeActions parameters are null. ProcessAgentActions is a DataContract-serialized container that must hold at least one action group — an agent step with zero actions is meaningless in the process model.","triggerScenarios":"Constructing a new ProcessAgentActions() with no arguments, or passing both codeActions: null and declarativeActions: null. This also occurs indirectly when ProcessAgentBuilder.BuildStep assembles a ProcessAgentActions whose nested code/declarative objects are both effectively absent (though the builder normally provides non-null wrappers).","commonSituations":"Manually instantiating ProcessAgentActions for testing or serialization without providing at least one action group. Building an agent step that defines neither OnComplete/OnError code callbacks nor declarative conditions.","solutions":["Provide at least one non-null action group: either a ProcessAgentCodeActions or a ProcessAgentDeclarativeActions (or both).","If building through ProcessAgentBuilder, ensure that you call OnComplete(...) or OnError(...) with at least one condition or that code callbacks are supplied via the constructor.","For unit tests, pass a minimal ProcessAgentCodeActions with a stub OnComplete/OnError action."],"exampleFix":"// before\nvar actions = new ProcessAgentActions(); // throws\n\n// after\nvar actions = new ProcessAgentActions(\n    codeActions: new ProcessAgentCodeActions\n    {\n        OnComplete = (value, ctx) => { /* ... */ }\n    });","handlingStrategy":"validation","validationCode":"public static ProcessAgentActions CreateActions(\n    ProcessAgentCodeActions? code = null,\n    ProcessAgentDeclarativeActions? declarative = null)\n{\n    if (code is null && declarative is null)\n    {\n        throw new ArgumentException(\"Provide at least one action group.\", nameof(code));\n    }\n    return new ProcessAgentActions(code, declarative);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass at least one non-null action group to ProcessAgentActions.","Use the ProcessAgentBuilder API rather than constructing ProcessAgentActions directly.","In tests, provide minimal stub ProcessAgentCodeActions."],"tags":["semantic-kernel","process-framework","agent-builder","validation","argument"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}