{"record":{"id":"5e1343b99142ec25","repo":"GoogleCloudPlatform/microservices-demo","slug":"failed-to-send-request","errorCode":null,"errorMessage":"failed to send request","messagePattern":"failed to send request","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/frontend/handlers.go","lineNumber":474,"sourceCode":"\n\ttype LLMResponse struct {\n\t\tContent string         `json:\"content\"`\n\t\tDetails map[string]any `json:\"details\"`\n\t}\n\n\tvar response LLMResponse\n\n\turl := \"http://\" + fe.shoppingAssistantSvcAddr\n\treq, err := http.NewRequest(http.MethodPost, url, r.Body)\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"failed to create request\"), http.StatusInternalServerError)\n\t\treturn\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"failed to send request\"), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"failed to read response\"), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"%+v\\n\", body)\n\tfmt.Printf(\"%+v\\n\", res)\n\n\terr = json.Unmarshal(body, &response)\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"failed to unmarshal body\"), http.StatusInternalServerError)\n\t\treturn\n\t}\n","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/GoogleCloudPlatform/microservices-demo/blob/72ba613a05f7fcee51cf1d0badff401b6ae7074d/src/frontend/handlers.go#L456-L492","documentation":"http.DefaultClient.Do failed at transport level when POSTing to the shopping assistant: connection refused, DNS failure, or timeout. The request object was built successfully, so this is purely a backend reachability failure.","triggerScenarios":"Thrown at src/frontend/handlers.go:474 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the shopping assistant service is running and its address/port are correct.","Use an http.Client with an explicit Timeout instead of http.DefaultClient.","Retry transient network errors with backoff.","Check network policies and service discovery between frontend and assistant."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"72ba613a05f7fcee51cf1d0badff401b6ae7074d","analyzedAt":"2026-09-02T01:15:09.673Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}