{"record":{"id":"0f882569e552fefe","repo":"microsoft/semantic-kernel","slug":"failed-to-start-process","errorCode":null,"errorMessage":"Failed to start process","messagePattern":"Failed to start process","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/DaprTestProcessContext.cs","lineNumber":50,"sourceCode":"            TypeInfoResolver = new ProcessStateTypeResolver<KickoffStep>(),\n            PropertyNamingPolicy = JsonNamingPolicy.CamelCase\n        };\n    }\n\n    /// <summary>\n    /// Starts the process with an initial event.\n    /// </summary>\n    /// <param name=\"initialEvent\">The initial event.</param>\n    /// <returns></returns>\n    internal async Task StartWithEventAsync(KernelProcessEvent initialEvent)\n    {\n        var daprProcess = DaprProcessInfo.FromKernelProcess(this._process);\n        var request = new ProcessStartRequest { Process = daprProcess, InitialEvent = initialEvent.ToJson() };\n\n        var response = await this._httpClient.PostAsJsonAsync($\"http://localhost:5200/processes/{this._processId}\", request, options: this._serializerOptions).ConfigureAwait(false);\n        if (!response.IsSuccessStatusCode)\n        {\n            throw new InvalidOperationException(\"Failed to start process\");\n        }\n    }\n\n    public override async Task<KernelProcess> GetStateAsync()\n    {\n        var response = await this._httpClient.GetFromJsonAsync<DaprProcessInfo>($\"http://localhost:5200/processes/{this._processId}\", options: this._serializerOptions);\n        return response switch\n        {\n            null => throw new InvalidOperationException(\"Process not found\"),\n            _ => response.ToKernelProcess()\n        };\n    }\n\n    public override Task SendEventAsync(KernelProcessEvent processEvent)\n    {\n        throw new NotImplementedException();\n    }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/DaprTestProcessContext.cs#L32-L68","documentation":"Thrown by `DaprTestProcessContext.StartWithEventAsync` when the HTTP POST that starts the process on the Dapr test host (port 5200) returns a non-success status code. The exception carries no body/detail, so the underlying failure (validation error, host error, transport issue) must be inferred from logs. It is an InvalidOperationException.","triggerScenarios":"POST to `http://localhost:5200/processes/{id}` with a start request whose `Process` or `InitialEvent` is malformed/rejected by the host; the Dapr test host is up but returns 4xx/5xx; the process payload references unknown steps.","commonSituations":"Dapr runtime/test host running but misconfigured; process serialization mismatch between client and host versions; initial event payload schema mismatch; port conflict putting a different service on 5200.","solutions":["Check the Dapr test host logs for the actual error behind the non-success status code.","Verify `localhost:5200` is the Dapr process host (not another service) and that it is the expected version.","Inspect the serialized `ProcessStartRequest` JSON for null/malformed `Process` or `InitialEvent`.","Confirm the process object is valid (non-null Id, resolvable steps) before posting."],"exampleFix":"// before\nvar response = await this._httpClient.PostAsJsonAsync(url, request);\nresponse.EnsureSuccessStatusCode(); // opaque\n// after (surface the body for diagnosis)\nvar response = await this._httpClient.PostAsJsonAsync(url, request);\nif (!response.IsSuccessStatusCode)\n{\n    var body = await response.Content.ReadAsStringAsync();\n    throw new InvalidOperationException($\"Failed to start process: {(int)response.StatusCode} {response.StatusCode}: {body}\");\n}","handlingStrategy":"retry","validationCode":"if (string.IsNullOrWhiteSpace(process?.State?.Id))\n    throw new InvalidOperationException(\"Cannot start a process with no Id via Dapr.\");\nvar request = new ProcessStartRequest { Process = DaprProcessInfo.FromKernelProcess(process), InitialEvent = initialEvent.ToJson() };\nif (string.IsNullOrWhiteSpace(request.InitialEvent))\n    throw new InvalidOperationException(\"InitialEvent serialized to null; check initialEvent payload.\");","typeGuard":"bool IsStartable(KernelProcess p, KernelProcessEvent e) =>\n    !string.IsNullOrWhiteSpace(p?.State?.Id) && e is not null;","tryCatchPattern":"try { await context.StartWithEventAsync(initialEvent); }\ncatch (InvalidOperationException ex) when (ex.Message == \"Failed to start process\")\n{\n    var body = await lastResponse.Content.ReadAsStringAsync();\n    _logger.LogError(\"Dapr start failed: {Body}\", body);\n    throw;\n}","preventionTips":["Confirm the Dapr test host is the service on port 5200 before running.","Log the response body/status on failure to avoid the opaque message.","Validate the process and initial event payloads before posting."],"tags":["dapr","process-framework","integration-tests","network","http"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}