{"record":{"id":"f92a973635120ac7","repo":"microsoft/semantic-kernel","slug":"dapr-test-host-did-not-start","errorCode":null,"errorMessage":"Dapr Test Host did not start","messagePattern":"Dapr Test Host did not start","errorType":"exception","errorClass":"InvalidProgramException","httpStatus":null,"severity":"critical","filePath":"dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs","lineNumber":115,"sourceCode":"                break;\n            }\n\n            try\n            {\n                var healthResponse = await this._httpClient!.GetAsync(new Uri(\"http://localhost:5200/daprHealth\"));\n                if (healthResponse.StatusCode == HttpStatusCode.OK)\n                {\n                    await Task.Delay(TimeSpan.FromSeconds(10));\n                    return;\n                }\n            }\n            catch (HttpRequestException)\n            {\n                // Do nothing, just wait\n            }\n        }\n\n        throw new InvalidProgramException(\"Dapr Test Host did not start\");\n    }\n\n    /// <summary>\n    /// Starts a process.\n    /// </summary>\n    /// <param name=\"process\">The process to start.</param>\n    /// <param name=\"kernel\">An instance of <see cref=\"Kernel\"/></param>\n    /// <param name=\"initialEvent\">An optional initial event.</param>\n    /// <param name=\"externalMessageChannel\">channel used for external messages</param>\n    /// <returns>A <see cref=\"Task{KernelProcessContext}\"/></returns>\n    public async Task<KernelProcessContext> StartProcessAsync(KernelProcess process, Kernel kernel, KernelProcessEvent initialEvent, IExternalKernelProcessMessageChannel? externalMessageChannel = null)\n    {\n        // Actual Kernel injection of Kernel and ExternalKernelProcessMessageChannel is in dotnet\\src\\Experimental\\Process.IntegrationTestHost.Dapr\\Program.cs\n        var context = new DaprTestProcessContext(process, this._httpClient!);\n        await context.StartWithEventAsync(initialEvent);\n        return context;\n    }\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/ProcessTestFixture.cs#L97-L133","documentation":"Thrown by the Dapr `ProcessTestFixture` after a bounded health-check loop against the Dapr test host never observed an HTTP 200 health response. The fixture polls the health endpoint (with try/catch swallowing `HttpRequestException`) and, if no OK is seen within the loop bounds, abandons startup. It is an InvalidProgramException.","triggerScenarios":"The Dapr test host process failed to launch, crashed during startup, or is unreachable (port not listening, firewall); the health endpoint path/port is wrong; the host is too slow and exceeds the retry budget.","commonSituations":"Dapr CLI/runtime not installed or wrong version; the test host port is already in use; CI environment lacks network/binding permissions; the host startup throws before binding the health route.","solutions":["Manually start the Dapr test host and `curl` the health endpoint to confirm it returns 200.","Check the host process logs for startup exceptions (binding, missing Dapr sidecar, config).","Ensure the expected port is free and the Dapr runtime (daprd) is running.","If the host is slow, increase the health-check retry budget in the fixture."],"exampleFix":"// before (host never reachable)\n// run tests directly after building\n// after (verify host + health manually first)\n// 1) dotnet run --project Process.IntegrationTestRunner.Dapr.Host\n// 2) curl http://localhost:<port>/health  -> expect 200\n// 3) then run the test suite","handlingStrategy":"validation","validationCode":"using var probe = new HttpClient();\nvar ok = false;\nfor (int i = 0; i < 30; i++)\n{\n    try\n    {\n        using var r = await probe.GetAsync(\"http://localhost:5200/health\");\n        if (r.IsSuccessStatusCode) { ok = true; break; }\n    }\n    catch (HttpRequestException) { }\n    await Task.Delay(1000);\n}\nif (!ok) throw new InvalidOperationException(\"Dapr host health check failed; aborting tests.\");","typeGuard":"bool IsPortListening(int port) =>\n    System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()\n        .GetActiveTcpListeners().Any(a => a.Port == port);","tryCatchPattern":"try { await fixture.InitializeAsync(); }\ncatch (InvalidProgramException ex) when (ex.Message.Contains(\"Dapr Test Host did not start\"))\n{ _logger.LogCritical(ex, \"Dapr host unreachable; verify runtime/port.\"); throw; }","preventionTips":["Start and health-check the Dapr host manually before running the suite.","Ensure the Dapr CLI/runtime is installed and the expected port is free.","In CI, add an explicit host-ready wait step with a clear timeout."],"tags":["dapr","process-framework","integration-tests","infrastructure","startup","health-check"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}