{"record":{"id":"e79657614b94e5fd","repo":"microsoft/semantic-kernel","slug":"the-step-has-not-been-initialized-e79657","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.LocalRuntime/LocalStep.cs","lineNumber":142,"sourceCode":"    /// <returns>A <see cref=\"ValueTask\"/></returns>\n    public ValueTask EmitEventAsync(KernelProcessEvent processEvent)\n    {\n        Verify.NotNullOrWhiteSpace(processEvent.Id, $\"{nameof(processEvent)}.{nameof(KernelProcessEvent.Id)}\");\n\n        ProcessEvent emitEvent = ProcessEvent.Create(processEvent, this._eventNamespace);\n        if (this.EventProxy?.Invoke(emitEvent) ?? true)\n        {\n            this.EmitEvent(emitEvent);\n        }\n\n        return default;\n    }\n\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":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.LocalRuntime/LocalStep.cs#L124-L160","documentation":"Thrown by LocalStep.AssignStepFunctionParameterValues when _functions, _inputs, or _initialInputs are null. These fields are populated during the lazy InitializeStepAsync call. This error means parameter assignment was attempted before the step completed initialization, or after its state was cleared.","triggerScenarios":"AssignStepFunctionParameterValues is invoked on a LocalStep whose InitializeStepAsync has not yet been awaited (the _initializeTask has not completed). Under normal flow HandleMessageAsync awaits the initialization task first; direct calls bypass this guard.","commonSituations":"Calling AssignStepFunctionParameterValues outside of the HandleMessageAsync flow; a race condition where messages are processed before initialization; reusing a step instance after DeinitializeStepAsync.","solutions":["Route messages through HandleMessageAsync which awaits _initializeTask.Value before calling AssignStepFunctionParameterValues.","Ensure StartAsync or RunOnceAsync is called so the lazy initialization is triggered.","Do not call internal methods directly; use the public/internal process API surface."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Route messages through HandleMessageAsync, never call AssignStepFunctionParameterValues directly.","Ensure the process's lazy initialization is triggered via StartAsync or RunOnceAsync before messages arrive.","Do not reuse step instances after DeinitializeStepAsync."],"tags":["process-framework","step","initialization","internal-error"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}