{"record":{"id":"5d5fb08047e5423a","repo":"microsoft/semantic-kernel","slug":"the-step-has-not-been-initialized-5d5fb0","errorCode":null,"errorMessage":"The step has not been initialized.","messagePattern":"The step has not been initialized\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs","lineNumber":225,"sourceCode":"\n    /// <summary>\n    /// The name of the step.\n    /// </summary>\n    protected virtual string Name => this._stepInfo?.State.Name ?? throw new KernelException(\"The Step must be initialized before accessing the Name property.\").Log(this._logger);\n\n    /// <summary>\n    /// Emits an event from the step.\n    /// </summary>\n    /// <param name=\"processEvent\">The event to emit.</param>\n    /// <returns>A <see cref=\"ValueTask\"/></returns>\n    public ValueTask EmitEventAsync(KernelProcessEvent processEvent) => this.EmitEventAsync(ProcessEvent.Create(processEvent, this._eventNamespace!));\n\n    // TODO: this can be moved to shared runtime code, looks almost/same to localRuntime implementation\n    internal virtual void AssignStepFunctionParameterValues(ProcessMessage message)\n    {\n        if (this._functions is null || this._inputs is null || this._initialInputs is null)\n        {\n            throw new KernelException(\"The step has not been initialized.\").Log(this._logger);\n        }\n\n        // Add the message values to the inputs for the function\n        foreach (var kvp in message.Values)\n        {\n            if (this._inputs.TryGetValue(message.FunctionName, out Dictionary<string, object?>? functionName) && functionName != null && functionName.TryGetValue(kvp.Key, out object? parameterName) && parameterName != null)\n            {\n                this._logger?.LogWarning(\"Step {StepName} already has input for {FunctionName}.{Key}, it is being overwritten with a message from Step named '{SourceId}'.\", this.Name, message.FunctionName, kvp.Key, message.SourceId);\n            }\n\n            if (!this._inputs.TryGetValue(message.FunctionName, out Dictionary<string, object?>? functionParameters))\n            {\n                this._inputs[message.FunctionName] = [];\n                functionParameters = this._inputs[message.FunctionName];\n            }\n\n            if (kvp.Value is KernelProcessEventData proxyData)\n            {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs#L207-L243","documentation":"StepActor.AssignStepFunctionParameterValues checks that _functions, _inputs, and _initialInputs are non-null. These are populated during ActivateStepAsync (lazy via _activateTask). If activation has not completed or failed, the fields remain in an uninitialized state and this KernelException is thrown.","triggerScenarios":"AssignStepFunctionParameterValues is called before ActivateStepAsync has populated the function/input dictionaries. Since HandleMessageAsync awaits _activateTask.Value before calling this method, the throw indicates activation faulted or was bypassed.","commonSituations":"ActivateStepAsync threw an exception (e.g. DI resolution failure, method-not-found, state deserialization error) that was stored in the Lazy<ValueTask> and surfaces here. Also from direct calls in tests that skip activation.","solutions":["Ensure the Kernel's service provider can resolve all dependencies needed by ActivatorUtilities.CreateInstance for the step type.","Check that ActivateStepAsync did not throw by inspecting the faulted Lazy<ValueTask> — look for earlier logged exceptions from the step actor.","In tests, trigger lazy activation by awaiting the activate task before calling AssignStepFunctionParameterValues directly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure activation succeeds by triggering it through a normal method call first:\nawait stepActor.InitializeStepAsync(stepInfo, parentProcessId);\n// Trigger lazy activation:\ntry { await stepActor.PrepareIncomingMessagesAsync(); }\ncatch (Exception ex) { logger.LogError(ex, \"Step activation failed; check DI and state type.\"); }","typeGuard":null,"tryCatchPattern":"try\n{\n    await stepActor.ProcessIncomingMessagesAsync();\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"step has not been initialized\"))\n{\n    logger.LogError(\"Step activation failed. Inspect earlier logs for the root cause (DI, type loading, or state deserialization).\");\n}","preventionTips":["Ensure the Kernel's DI container can resolve all step dependencies.","Verify the step type and state type are loadable and compatible.","Monitor actor logs for activation exceptions that precede this guard."],"tags":["dapr","process-runtime","initialization","activation","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}