{"record":{"id":"7c387d99d7a7a72b","repo":"XTLS/Xray-core","slug":"failed-to-read-http-response","errorCode":null,"errorMessage":"failed to read HTTP response","messagePattern":"failed to read HTTP response","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main/commands/all/api/shared.go","lineNumber":105,"sourceCode":"\t\tTimeout: 30 * time.Second,\n\t}\n\tresp, err := client.Do(&http.Request{\n\t\tMethod: \"GET\",\n\t\tURL:    parsedTarget,\n\t\tClose:  true,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to dial to %s\", target)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected HTTP status code: %d\", resp.StatusCode)\n\t}\n\n\tcontent, err := buf.ReadAllToBytes(resp.Body)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to read HTTP response\")\n\t}\n\n\treturn content, nil\n}\n\nfunc showJSONResponse(m proto.Message) {\n\tif isNil(m) {\n\t\treturn\n\t}\n\tif j, ok := creflect.MarshalToJson(m, true); ok {\n\t\tfmt.Println(j)\n\t} else {\n\t\tfmt.Fprintf(os.Stdout, \"%v\\n\", m)\n\t\tbase.Fatalf(\"error encode json\")\n\t}\n}\n\nfunc isNil(i interface{}) bool {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/main/commands/all/api/shared.go#L87-L123","documentation":"Error \"failed to read HTTP response\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at main/commands/all/api/shared.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}