{"record":{"id":"1951f8604125a515","repo":"Devolutions/UniGetUI","slug":"string-isnullorwhitespace-content-response-reas","errorCode":null,"errorMessage":"string.IsNullOrWhiteSpace(content) ? response.ReasonPhrase : content","messagePattern":"string\\.IsNullOrWhiteSpace\\(content\\) \\? response\\.ReasonPhrase : content","errorType":"http","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcClient.cs","lineNumber":1079,"sourceCode":"        return await SendAsync(method, relativePath, parameters, requestContent);\n    }\n\n    private async Task<string> SendAsync(\n        HttpMethod method,\n        string relativePath,\n        IReadOnlyDictionary<string, string>? queryParameters = null,\n        HttpContent? requestContent = null\n    )\n    {\n        using var timeout = new CancellationTokenSource(GetRequestTimeout(method, relativePath));\n        using var request = new HttpRequestMessage(method, BuildRelativeUri(relativePath, queryParameters));\n        request.Content = requestContent;\n        using var response = await _httpClient.SendAsync(request, timeout.Token);\n        string content = await response.Content.ReadAsStringAsync();\n\n        if (!response.IsSuccessStatusCode)\n        {\n            throw new InvalidOperationException(\n                string.IsNullOrWhiteSpace(content) ? response.ReasonPhrase : content\n            );\n        }\n\n        return content;\n    }\n\n    private async Task<T?> ReadAuthenticatedJsonAsync<T>(\n        HttpMethod method,\n        string relativePath,\n        IReadOnlyDictionary<string, string>? queryParameters = null\n    )\n    {\n        string json = await SendAuthenticatedAsync(method, relativePath, queryParameters);\n        return IpcJson.Deserialize<T>(json);\n    }\n\n    private async Task<TResponse?> ReadAuthenticatedJsonWithBodyAsync<TResponse, TBody>(","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcClient.cs#L1061-L1097","documentation":"Thrown by IpcClient.SendAsync whenever the HTTP response status is not success (2xx). The exception message is the response body if non-blank, otherwise the HTTP reason phrase. This is the generic non-OK gateway: every IPC call that fails server-side surfaces here with whatever the server wrote.","triggerScenarios":"Any IPC request returning 4xx/5xx: 401/403 when the token is wrong or SecureSettings denies the action, 404 for unknown routes/ids, 400 for server-side validation failures, 500 for unhandled server exceptions, 503 when the backend manager process is unavailable. The token is attached as a query parameter before this call.","commonSituations":"Token mismatch after UniGetUI regenerated the IPC token on restart. Hitting an endpoint gated by a SecureSettings flag that is off. Server-side InvalidOperationException (errors 20-23, 33-39) propagated as a 400/500 body. Manager executable missing producing a server error. Network reset returning a non-success code.","solutions":["Inspect the exception Message: if non-empty it is the server's response body, which usually names the real problem.","Confirm the IPC token is current (re-discover it from the running UniGetUI session).","Call GetStatusAsync first to confirm the server is alive and the token is accepted.","Map the HTTP status: 401/403 -> token/secure-settings; 404 -> wrong id/route; 5xx -> server log.","Wrap IPC calls and log ex.Message plus the relative path to correlate with server logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Liveness + auth probe before protected calls:\nvar status = await client.GetStatusAsync();\nif (!status.Running) { /* server unavailable */ }","typeGuard":null,"tryCatchPattern":"try { return await client.SendSomethingAsync(...); }\ncatch (InvalidOperationException ex)\n{\n    // ex.Message is the server response body (or HTTP reason phrase).\n    logger.LogError(\"IPC call failed: {Message}\", ex.Message);\n    throw;\n}","preventionTips":["Always log ex.Message for IPC failures; it carries the server's diagnostic body.","Call GetStatusAsync first to validate reachability and token acceptance.","Rediscover the endpoint/token when you see 401/403-shaped messages."],"tags":["ipc","client","http","transport","generic-error"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}