{"record":{"id":"7f0121179e7787b6","repo":"SonarSource/sonarqube","slug":"failed-to-write-the-github-app-manifest-response","errorCode":null,"errorMessage":"Failed to write the GitHub App Manifest response","messagePattern":"Failed to write the GitHub App Manifest response","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"warning","filePath":"server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/CreateGithubFromManifestAction.java","lineNumber":193,"sourceCode":"   * configurable.\n   */\n  private static Set<String> resolveAllowedOrganizations(Request request, @Nullable String organization) {\n    String rawValue = request.param(PARAM_ALLOWED_ORGANIZATIONS);\n    if (rawValue != null) {\n      return Arrays.stream(rawValue.split(\",\"))\n        .map(String::trim)\n        .filter(value -> !value.isEmpty())\n        .collect(toCollection(LinkedHashSet::new));\n    }\n    return isBlank(organization) ? Set.of() : Set.of(organization);\n  }\n\n  private static void writeJson(Response response, String json) {\n    response.stream().setMediaType(MediaTypes.JSON);\n    try {\n      response.stream().output().write(json.getBytes(StandardCharsets.UTF_8));\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Failed to write the GitHub App Manifest response\", e);\n    }\n  }\n}\n","sourceCodeStart":175,"sourceCodeEnd":197,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/CreateGithubFromManifestAction.java#L175-L197","documentation":"IllegalStateException from CreateGithubFromManifestAction.writeJson: the JSON response of the GitHub App manifest exchange could not be written to the HTTP response stream (IOException). This is an infrastructure-level failure after the manifest config code was already retrieved.","triggerScenarios":"api/alm_settings/create_github_from_manifest processing completes but response.output().write() throws IOException — typically client disconnect, container connection abort, or full buffers.","commonSituations":"User closes the browser during the GitHub App redirect-back handshake; reverse proxy drops the connection; server resource exhaustion.","solutions":["Retry the GitHub App manifest creation from the start","Check proxy/load-balancer timeout settings on the callback path","Inspect server logs for the wrapped IOException to find the root cause"],"exampleFix":"// before\n// no retry on write failure\nwriteJson(response, json);\n// after\ntry {\n  writeJson(response, json);\n} catch (IllegalStateException e) {\n  logger.warn(\"Client likely disconnected during manifest callback\", e);\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  const resp = await ws.post('api/alm_settings/create_github_from_manifest', params);\n} catch (e) {\n  if (e instanceof IllegalStateException && /Failed to write the GitHub App Manifest response/.test(e.message)) {\n    logger.warn('Client disconnected during manifest callback; retry the flow', e);\n  } else { throw e; }\n}","preventionTips":["Keep proxy/client timeouts long enough for the manifest handshake","Avoid closing the browser during the GitHub App redirect-back","Retry the whole manifest flow on this error; it is safe to re-run"],"tags":["sonarqube","github-app","io","response-stream"],"backgroundTag":"broken-pipe","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}