{"record":{"id":"c95434c115ddc5cf","repo":"Devolutions/UniGetUI","slug":"timed-out-while-waiting-for-operation-operationid","errorCode":null,"errorMessage":"Timed out while waiting for operation {operationId}.","messagePattern":"Timed out while waiting for operation (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/UniGetUI.Interface.IpcApi/IpcClient.cs","lineNumber":186,"sourceCode":"\n        DateTime deadline = DateTime.UtcNow.AddSeconds(timeoutSeconds);\n        while (true)\n        {\n            var operation = await GetOperationAsync(operationId)\n                ?? throw new InvalidOperationException(\n                    $\"No tracked operation with id \\\"{operationId}\\\" was found.\"\n                );\n\n            if (\n                operation.Status is \"succeeded\" or \"failed\" or \"canceled\"\n            )\n            {\n                return operation;\n            }\n\n            if (DateTime.UtcNow >= deadline)\n            {\n                throw new InvalidOperationException(\n                    $\"Timed out while waiting for operation {operationId}.\"\n                );\n            }\n\n            await Task.Delay(delayMilliseconds);\n        }\n    }\n\n    public async Task<IpcCommandResult> CancelOperationAsync(string operationId)\n    {\n        return await ReadAuthenticatedJsonAsync<IpcCommandResult>(\n                HttpMethod.Post,\n                IpcHttpRoutes.Path($\"/operations/{Uri.EscapeDataString(operationId)}/cancel\")\n            )\n            ?? new IpcCommandResult\n            {\n                Status = \"error\",\n                Command = \"cancel-operation\",","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcClient.cs#L168-L204","documentation":"Thrown inside IpcClient.WaitForOperationAsync when the polling deadline (DateTime.UtcNow >= deadline) is reached before the operation reaches a terminal status (succeeded/failed/canceled). The deadline is startTime + Clamp(timeoutSeconds,1,3600), checked once per loop iteration after each poll.","triggerScenarios":"An operation that runs longer than the supplied timeoutSeconds (default 300). A long package install/uninstall on a slow manager, a hung elevated process, or an operation stuck in a non-terminal status. Also if delayMilliseconds is large relative to timeout so few polls occur.","commonSituations":"Large bundle installs exceeding the 5-minute default. Network-bound managers (pip, npm) slow on cold cache. An operation whose manager process is awaiting interactive input and never returns. Defaulting to the 300s timeout for genuinely long tasks.","solutions":["Increase timeoutSeconds (up to the 3600 clamp) when calling WaitForOperationAsync for long operations.","Call CancelOperationAsync then resubmit if the operation is genuinely hung.","Check the operation output endpoint for clues about what it is blocked on.","Lower delayMilliseconds to poll more frequently and react sooner to completion."],"exampleFix":"// before\nvar result = await client.WaitForOperationAsync(id); // 300s default\n// after\nvar result = await client.WaitForOperationAsync(id, timeoutSeconds: 1800);","handlingStrategy":"retry","validationCode":"// Choose timeout based on expected operation cost:\nint timeout = operationKind switch\n{\n    \"install\" or \"uninstall\" => 1800, // long-running\n    _ => 300,\n};","typeGuard":null,"tryCatchPattern":"try { await client.WaitForOperationAsync(id, timeoutSeconds: 1800); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Timed out\"))\n{ /* inspect output, cancel if hung, or retry with a longer timeout */ }","preventionTips":["Scale timeoutSeconds to the worst-case operation duration (clamped to 3600).","Cancel and resubmit operations that are genuinely hung rather than extending the timeout indefinitely.","Poll operation output to detect interactive prompts blocking completion."],"tags":["ipc","client","operations","timeout","polling"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}