{"record":{"id":"f6773c793d850380","repo":"Devolutions/UniGetUI","slug":"the-ipc-api-token-is-not-available-start-unigetui","errorCode":null,"errorMessage":"The IPC API token is not available. Start UniGetUI and try again.","messagePattern":"The IPC API token is not available\\. Start UniGetUI and try again\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcClient.cs","lineNumber":1488,"sourceCode":"\n    private static bool IsProcessRunning(int processId)\n    {\n        try\n        {\n            using Process process = Process.GetProcessById(processId);\n            return !process.HasExited;\n        }\n        catch (Exception)\n        {\n            return false;\n        }\n    }\n\n    private void EnsureTokenAvailable()\n    {\n        if (string.IsNullOrWhiteSpace(_token))\n        {\n            throw new InvalidOperationException(\n                \"The IPC API token is not available. Start UniGetUI and try again.\"\n            );\n        }\n    }\n\n    private static string BuildRelativeUri(\n        string relativePath,\n        IReadOnlyDictionary<string, string>? queryParameters\n    )\n    {\n        if (queryParameters is null || queryParameters.Count == 0)\n        {\n            return relativePath;\n        }\n\n        string query = string.Join(\n            \"&\",\n            queryParameters.Select(pair =>","sourceCodeStart":1470,"sourceCodeEnd":1506,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcClient.cs#L1470-L1506","documentation":"Thrown by IpcClient.EnsureTokenAvailable when the _token field is null or whitespace. EnsureTokenAvailable guards every authenticated send (SendAuthenticatedAsync), so any protected IPC call made on a tokenless client fails immediately before any network attempt.","triggerScenarios":"Constructing an IpcClient without a token and then calling any authenticated method. Discovering endpoints when none have a token persisted. The token file/registration being unreadable or absent because UniGetUI is not running or has not yet written its IPC token.","commonSituations":"UniGetUI is not running, so no endpoint registration (and thus no token) exists. Calling IPC before the app has finished booting and written its token. Manually constructing a client for testing without passing the token. Stale registration left over after the app crashed without cleaning up.","solutions":["Start UniGetUI so it publishes its IPC token, then rediscover the endpoint/token.","Construct IpcClient with the token from a valid IpcEndpointRegistration rather than null/empty.","Call GetStatusAsync (an unauthenticated route) only after ensuring the client has a token for protected routes.","Use the endpoint-discovery helper to find a live, token-bearing registration before building the client."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Discover a token-bearing live endpoint before constructing the client:\nvar reg = IpcClient.FindLiveEndpoint();\nif (reg is null || string.IsNullOrWhiteSpace(reg.Token))\n    throw new InvalidOperationException(\"UniGetUI is not running or has no IPC token.\");\nusing var client = new IpcClient(reg.ToTransportOptions(), reg.Token);","typeGuard":null,"tryCatchPattern":"try { await client.DoAuthenticatedCallAsync(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"token is not available\"))\n{ /* start UniGetUI, rediscover endpoint, rebuild client with token */ }","preventionTips":["Ensure UniGetUI is running and has published its token before any protected IPC call.","Never construct an IpcClient for protected routes with a null/empty token.","Use the endpoint-discovery helper to obtain both transport options and token together."],"tags":["ipc","client","auth","token","configuration"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}