{"record":{"id":"5f9c232b3229e435","repo":"GoogleCloudPlatform/microservices-demo","slug":"failed-to-complete-the-order","errorCode":null,"errorMessage":"failed to complete the order","messagePattern":"failed to complete the order","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/frontend/handlers.go","lineNumber":372,"sourceCode":"\torder, err := pb.NewCheckoutServiceClient(fe.checkoutSvcConn).\n\t\tPlaceOrder(r.Context(), &pb.PlaceOrderRequest{\n\t\t\tEmail: payload.Email,\n\t\t\tCreditCard: &pb.CreditCardInfo{\n\t\t\t\tCreditCardNumber:          payload.CcNumber,\n\t\t\t\tCreditCardExpirationMonth: int32(payload.CcMonth),\n\t\t\t\tCreditCardExpirationYear:  int32(payload.CcYear),\n\t\t\t\tCreditCardCvv:             int32(payload.CcCVV)},\n\t\t\tUserId:       sessionID(r),\n\t\t\tUserCurrency: currentCurrency(r),\n\t\t\tAddress: &pb.Address{\n\t\t\t\tStreetAddress: payload.StreetAddress,\n\t\t\t\tCity:          payload.City,\n\t\t\t\tState:         payload.State,\n\t\t\t\tZipCode:       int32(payload.ZipCode),\n\t\t\t\tCountry:       payload.Country},\n\t\t})\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"failed to complete the order\"), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tlog.WithField(\"order\", order.GetOrder().GetOrderId()).Info(\"order placed\")\n\n\torder.GetOrder().GetItems()\n\trecommendations, _ := fe.getRecommendations(r.Context(), sessionID(r), nil)\n\n\ttotalPaid := *order.GetOrder().GetShippingCost()\n\tfor _, v := range order.GetOrder().GetItems() {\n\t\tmultPrice := money.MultiplySlow(*v.GetCost(), uint32(v.GetItem().GetQuantity()))\n\t\ttotalPaid = money.Must(money.Sum(totalPaid, multPrice))\n\t}\n\n\tcurrencies, err := fe.getCurrencies(r.Context())\n\tif err != nil {\n\t\trenderHTTPError(log, r, w, errors.Wrap(err, \"could not retrieve currencies\"), http.StatusInternalServerError)\n\t\treturn\n\t}","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/GoogleCloudPlatform/microservices-demo/blob/72ba613a05f7fcee51cf1d0badff401b6ae7074d/src/frontend/handlers.go#L354-L390","documentation":"Wraps the gRPC error returned by the CheckoutService PlaceOrder RPC. It fires when the checkout backend is unreachable, times out, or rejects the order (invalid card details, unsupported currency, or a downstream failure in payment/cart/currency services).","triggerScenarios":"Thrown at src/frontend/handlers.go:372 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check connectivity and health of the checkout service from the frontend.","Inspect the wrapped gRPC status code to distinguish transport failure from order rejection (invalid credit card or address).","Validate the submitted form fields (email, card number, expiry, CVV, address) before calling PlaceOrder.","Retry transient UNAVAILABLE/DEADLINE_EXCEEDED failures with backoff; surface a user-friendly checkout error otherwise."],"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"}