{"record":{"id":"5c0f8b43435f7890","repo":"theonedev/onedev","slug":"http-request-failed-status-s-5c0f8b","errorCode":null,"errorMessage":"Http request failed (status: %s)","messagePattern":"Http request failed \\(status: (.+?)\\)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-import-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java","lineNumber":548,"sourceCode":"\t\t\t\tint status = response.getStatus();\n\t\t\t\tif (status != 200) {\n\t\t\t\t\tString errorMessage = response.readEntity(String.class);\n\t\t\t\t\tif (StringUtils.isNotBlank(errorMessage)) {\n\t\t\t\t\t\tif (errorMessage.contains(\"rate limit exceeded\")) {\n\t\t\t\t\t\t\tlong resetTime = Long.parseLong(response.getHeaderString(\"x-ratelimit-reset\"))*1000L;\n\t\t\t\t\t\t\tlogger.log(\"Rate limit exceeded, wait until reset...\");\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tThread.sleep(resetTime + 60*1000L - System.currentTimeMillis());\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new ExplicitException(String.format(\"Http request failed (url: %s, status code: %d, error message: %s)\", \n\t\t\t\t\t\t\t\t\tapiEndpoint, status, errorMessage));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new ExplicitException(String.format(\"Http request failed (status: %s)\", status));\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\treturn response.readEntity(JsonNode.class);\n\t\t\t}\n\t\t}\n\t}\n\n\tTaskResult importProjects(ImportRepositories repositories, \n\t\t\tProjectImportOption option, boolean dryRun, TaskLogger logger) {\n\t\tClient client = newClient();\n\t\ttry {\n\t\t\tMap<String, Optional<Long>> userIds = new HashMap<>();\n\t\t\tImportResult result = new ImportResult();\n\t\t\tfor (var gitHubRepository: repositories.getImportRepositories()) {\n\t\t\t\tOneDev.getInstance(TransactionService.class).run(() -> {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tString oneDevProjectPath = gitHubRepository;\n\t\t\t\t\t\tif (repositories.getParentOneDevProject() != null)","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java#L530-L566","documentation":"The GitHub importer's get() helper throws this when the HTTP response status is not acceptable and the response does not carry the expected structured error payload (no error message could be extracted), so only the raw status is reported.","triggerScenarios":"A get() call (from email(), list(), repoNode()) where response.getStatusInfo() is an error but the body lacks the expected JSON error message — e.g. empty body, HTML error page, proxy interception, or unexpected status family.","commonSituations":"Corporate proxy or firewall returning an HTML block page; GitHub 5xx with empty body; misconfigured API endpoint URL hitting a non-GitHub server; network appliances mangling responses.","solutions":["Print/inspect the raw response body and status via curl against the same apiEndpoint","Verify the configured GitHub API endpoint URL is correct (https://api.github.com)","Check proxy/firewall settings that may intercept API traffic","Retry later if GitHub is having an incident (status.github.com)"],"exampleFix":"// before\napiEndpoint = \"https://github.example.internal/api/v3/repos/...\"; // proxy block page\n// after\napiEndpoint = \"https://api.github.com/repos/...\";","handlingStrategy":"retry","validationCode":"// Reachability precheck expecting JSON:\nvar resp = client.target(apiEndpoint).request().get();\nif (!resp.getMediaType().toString().contains(\"json\"))\n    throw new IllegalStateException(\"Endpoint not returning JSON: \" + resp.getMediaType());","typeGuard":null,"tryCatchPattern":"try { node = get(client, apiEndpoint, logger); }\ncatch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Http request failed (status\")) {\n        // inspect raw response/proxy; retry with backoff or fix endpoint URL\n    } else throw e;\n}","preventionTips":["Confirm the API base URL points at api.github.com","Check proxy/firewall rules for API hosts","Monitor GitHub status for outages before large imports"],"tags":["github","http","api","import"],"backgroundTag":"http-error-response","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}