microsoft/semantic-kernel · error · InvalidOperationException
Process not found
Error message
Process not found
What it means
Thrown by `DaprTestProcessContext.GetStateAsync` when `GetFromJsonAsync<DaprProcessInfo>` returns null for the process state endpoint on port 5200. A null deserialization result means the host responded with empty or non-JSON content for the given process id. It is an InvalidOperationException.
Source
Thrown at dotnet/src/Experimental/Process.IntegrationTestRunner.Dapr/DaprTestProcessContext.cs:59
/// <returns></returns>
internal async Task StartWithEventAsync(KernelProcessEvent initialEvent)
{
var daprProcess = DaprProcessInfo.FromKernelProcess(this._process);
var request = new ProcessStartRequest { Process = daprProcess, InitialEvent = initialEvent.ToJson() };
var response = await this._httpClient.PostAsJsonAsync($"http://localhost:5200/processes/{this._processId}", request, options: this._serializerOptions).ConfigureAwait(false);
if (!response.IsSuccessStatusCode)
{
throw new InvalidOperationException("Failed to start process");
}
}
public override async Task<KernelProcess> GetStateAsync()
{
var response = await this._httpClient.GetFromJsonAsync<DaprProcessInfo>($"http://localhost:5200/processes/{this._processId}", options: this._serializerOptions);
return response switch
{
null => throw new InvalidOperationException("Process not found"),
_ => response.ToKernelProcess()
};
}
public override Task SendEventAsync(KernelProcessEvent processEvent)
{
throw new NotImplementedException();
}
public override Task StopAsync()
{
throw new NotImplementedException();
}
public override async Task<IExternalKernelProcessMessageChannel?> GetExternalMessageChannelAsync()
{
var response = await this._httpClient.GetFromJsonAsync<MockCloudEventClient>($"http://localhost:5200/processes/{this._processId}/mockCloudClient", options: this._serializerOptions);
return response switchView on GitHub (pinned to c028a0c7dc)
Solutions
- Confirm `_processId` was returned by a successful start call and is still active on the host.
- Check the host logs/health and retry after the process is confirmed running.
- Verify client and host agree on the `DaprProcessInfo` schema/version.
Example fix
// before
var response = await this._httpClient.GetFromJsonAsync<DaprProcessInfo>(url);
return response;
// after
var response = await this._httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var info = await response.Content.ReadFromJsonAsync<DaprProcessInfo>();
return info ?? throw new InvalidOperationException($"Process {_processId} returned empty state"); Defensive patterns
Strategy: retry
Validate before calling
using var probe = await httpClient.GetAsync($"http://localhost:5200/processes/{processId}");
if (!probe.IsSuccessStatusCode)
throw new InvalidOperationException($"Process {processId} not reachable: {probe.StatusCode}");
// then call GetStateAsync() Type guard
bool ProcessIdLooksValid(string id) => !string.IsNullOrWhiteSpace(id);
Try / catch
try { var state = await context.GetStateAsync(); }
catch (InvalidOperationException ex) when (ex.Message == "Process not found")
{ _logger.LogError(ex, "Process {Id} not found on Dapr host.", processId); throw; } Prevention
- Only query state for ids returned by a successful start.
- Confirm host/client schema versions match.
- Retry once after a short delay if the host may still be initializing.
When it happens
Trigger: Request state for a `_processId` that was never started or has been evicted; the host returns an empty 200 body; deserialization into `DaprProcessInfo` yields null due to a schema/JSON mismatch.
Common situations: Querying state before the process is fully started; the Dapr host lost/restarted the process; version mismatch between client and host `DaprProcessInfo` shapes; wrong process id.
Related errors
- Failed to start process
- Dapr Test Host did not start
- This method is not implemented in this test fixture.
- The Map must be initialized before accessing the Name proper
- The process cannot be started before it has been initialized
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/02a16f8156855ef9.
Report an issue: GitHub.