{"record":{"id":"a3fae65b685cfb5b","repo":"Devolutions/UniGetUI","slug":"the-current-unigetui-session-cannot-update-all-pac","errorCode":null,"errorMessage":"The current UniGetUI session cannot update all packages.","messagePattern":"The current UniGetUI session cannot update all packages\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":400,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcServer.cs","lineNumber":1595,"sourceCode":"                    IpcJson.Options\n                );\n            }\n            catch (InvalidOperationException ex)\n            {\n                context.Response.StatusCode = 400;\n                await context.Response.WriteAsync(ex.Message);\n            }\n        }\n\n        private async Task V3_UpdateAllPackages(HttpContext context)\n        {\n            await HandleCommandAsync(\n                context,\n                () =>\n                {\n                    if (OnUpgradeAll is null)\n                    {\n                        throw new InvalidOperationException(\n                            \"The current UniGetUI session cannot update all packages.\"\n                        );\n                    }\n\n                    OnUpgradeAll.Invoke(null, EventArgs.Empty);\n                    return IpcCommandResult.Success(\"update-all\");\n                }\n            );\n        }\n\n        private async Task V3_UpdateAllPackagesForManager(HttpContext context)\n        {\n            await HandleCommandAsync(\n                context,\n                () =>\n                {\n                    if (OnUpgradeAllForManager is null)\n                    {","sourceCodeStart":1577,"sourceCodeEnd":1613,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcServer.cs#L1577-L1613","documentation":"Thrown by the IPC server's POST v3 update-all endpoint when the OnUpgradeAll event has no subscriber. The host process (typically the main UniGetUI GUI) registers the handler; if it is null the endpoint cannot perform the bulk upgrade and refuses with InvalidOperationException. HandleCommandAsync catches it and returns HTTP 400 with this message as the body.","triggerScenarios":"Calling the IPC v3 update-all route (V3_UpdateAllPackages) while OnUpgradeAll is null — i.e. no GUI/session wired the upgrade-all callback before the request arrived.","commonSituations":"Headless/automation clients hitting the IPC API before the main app fully started; a forked/embedded use of IpcServer that never subscribed to OnUpgradeAll; calling the endpoint during shutdown after the handler was detached.","solutions":["Ensure the host subscribes to IpcServer.OnUpgradeAll before starting the listener (the normal UniGetUI app does this in startup wiring).","If integrating IpcServer standalone, attach a handler: server.OnUpgradeAll += (_, _) => { /* trigger upgrade-all */ };","As an API caller, treat HTTP 400 with this body as 'feature unavailable in this session' and surface a user-facing message rather than retrying."],"exampleFix":"// before: endpoint called but OnUpgradeAll never subscribed -> HTTP 400\n// after: wire the event before MapRoutes/RunAsync\nipcServer.OnUpgradeAll += (_, _) => PMManager.UpgradeAllPackages();\nawait ipcServer.StartAsync(cancellationToken);","handlingStrategy":"validation","validationCode":"// Before calling the update-all endpoint, confirm the host wired the handler.\n// (IPC clients cannot inspect OnUpgradeAll directly; treat HTTP 400 with this body as 'unavailable'.)\nif (response.StatusCode == HttpStatusCode.BadRequest &&\n    await response.Content.ReadAsStringAsync() == \"The current UniGetUI session cannot update all packages.\")\n{\n    // feature unavailable in this session\n}","typeGuard":null,"tryCatchPattern":"// Host side: never null if you wire the event. No try-catch needed.\n// If wiring conditionally, guard:\nif (ipcServer.OnUpgradeAll is not null) { /* safe to expose endpoint */ }","preventionTips":["Subscribe to OnUpgradeAll/OnUpgradeAllForManager during host startup, before calling StartAsync.","Document which IPC endpoints require host-side event wiring.","In standalone IpcServer use, treat unwired events as unsupported and 404 the route instead of throwing 400."],"tags":["ipc","http-400","event-not-wired","session-state"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}