{"record":{"id":"b04e850e5f15d84f","repo":"GoogleCloudPlatform/microservices-demo","slug":"shipment-failed-v","errorCode":null,"errorMessage":"shipment failed: %+v","messagePattern":"shipment failed: %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/checkoutservice/main.go","lineNumber":391,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not charge the card: %+v\", err)\n\t}\n\treturn paymentResp.GetTransactionId(), nil\n}\n\nfunc (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email string, order *pb.OrderResult) error {\n\t_, err := pb.NewEmailServiceClient(cs.emailSvcConn).SendOrderConfirmation(ctx, &pb.SendOrderConfirmationRequest{\n\t\tEmail: email,\n\t\tOrder: order})\n\treturn err\n}\n\nfunc (cs *checkoutService) shipOrder(ctx context.Context, address *pb.Address, items []*pb.CartItem) (string, error) {\n\tresp, err := pb.NewShippingServiceClient(cs.shippingSvcConn).ShipOrder(ctx, &pb.ShipOrderRequest{\n\t\tAddress: address,\n\t\tItems:   items})\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"shipment failed: %+v\", err)\n\t}\n\treturn resp.GetTrackingId(), nil\n}\n","sourceCodeStart":373,"sourceCodeEnd":395,"githubUrl":"https://github.com/GoogleCloudPlatform/microservices-demo/blob/72ba613a05f7fcee51cf1d0badff401b6ae7074d/src/checkoutservice/main.go#L373-L395","documentation":"checkoutservice's shipOrder wraps any error returned by the ShippingService gRPC ShipOrder call with fmt.Errorf(\"shipment failed: %+v\", err). It means the downstream shipping service rejected the request or the RPC failed (transport error, deadline, or application-level error). The %+v verb renders the full error chain including wrapped gRPC status details.","triggerScenarios":"pb.NewShippingServiceClient(cs.shippingSvcConn).ShipOrder(ctx, &pb.ShipOrderRequest{...}) returns a non-nil err: connection failure to the shipping service, gRPC Unavailable/DeadlineExceeded, or the shipping service rejecting the address/items payload.","commonSituations":"Shipping service pod down or not deployed; wrong SHIPPING_SERVICE_ADDR; network policy blocking the port; quote/shipping request timing out under load; invalid address causing the shipping service to return an error status.","solutions":["Check the shipping service is running and reachable: kubectl get pods / test the service endpoint on its gRPC port","Read the wrapped %+v error for the gRPC status code to identify transport vs application failure","Verify the shipping service address env var (e.g. SHIPPING_SERVICE_ADDR) points at the correct host:port","Add or increase the client timeout on the ShipOrder context if DeadlineExceeded","Validate address/items payload before calling ShipOrder to avoid application-level rejections"],"exampleFix":"// before\nreturn \"\", fmt.Errorf(\"shipment failed: %+v\", err)\n// after\nif status.Code(err) == codes.Unavailable {\n    return \"\", fmt.Errorf(\"shipment failed (shipping service unavailable, retry): %w\", err)\n}\nreturn \"\", fmt.Errorf(\"shipment failed: %w\", err)","handlingStrategy":"retry","validationCode":"if address == nil || len(items) == 0 {\n    return \"\", errors.New(\"shipOrder: address and items are required\")\n}\nif cs.shippingSvcConn == nil {\n    return \"\", errors.New(\"shipOrder: shipping service connection not initialized\")\n}","typeGuard":null,"tryCatchPattern":"trackingID, err := cs.shipOrder(ctx, addr, items)\nif err != nil {\n    if status.Code(err) == codes.Unavailable || status.Code(err) == codes.DeadlineExceeded {\n        // retry with backoff\n    }\n    return fmt.Errorf(\"order placement aborted: %w\", err)\n}","preventionTips":["Add retry-with-backoff policies on the shipping gRPC client","Set explicit per-call deadlines on ShipOrder","Health-check the shipping service before checkout flows","Validate address and items payloads before invoking ShipOrder"],"tags":["grpc","golang","microservices","checkout","shipping"],"backgroundTag":"grpc-rpc-failed","analyzedSha":"72ba613a05f7fcee51cf1d0badff401b6ae7074d","analyzedAt":"2026-09-02T01:15:09.673Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}