Troubleshooting
Common issues and solutions when using QWED-UCP.Installation Issues
”No module named ‘qwed_ucp’”
Cause: Package not installed correctly Solutions:-
Check Python version (requires 3.10+):
-
Install in correct environment:
-
Verify installation:
npm install fails for Express middleware
Cause: Node.js version incompatibility Solution:Verification Failures
”Total mismatch: expected Y”
Cause: Money Guard detected incorrect total calculation Debug:- Discount not subtracted
- Tax calculated on wrong base
- Rounding differences
Decimal for monetary calculations:
“Line item mismatch: qty × price ≠ line_total”
Cause: Line Items Guard detected math error Debug:- Floating-point precision issues
- Wrong quantity multiplied
- Missing items in calculation
”Invalid currency: JPY amounts cannot have decimals”
Cause: Currency Guard detected invalid format Zero-decimal currencies:- JPY (Japanese Yen)
- KRW (Korean Won)
- VND (Vietnamese Dong)
“Invalid state transition”
Cause: State Guard detected invalid checkout flow Valid transitions:completed → incomplete(can’t go back)cancelled → ready_for_complete(can’t resurrect)
Middleware Issues
FastAPI middleware not intercepting requests
Check route configuration:Express middleware returns 500 instead of 422
Check error handling:CORS issues with middleware
Solution for FastAPI:Performance Issues
Verification is slow
Optimize with caching:Common Errors Reference
| Error Message | Guard | Likely Cause | Fix |
|---|---|---|---|
| ”Total mismatch” | Money | Wrong total calculation | Recalculate total |
| ”Line item mismatch” | LineItems | qty × price error | Check each line |
| ”Invalid currency” | Currency | Bad format | Check ISO 4217 |
| ”Invalid transition” | State | Wrong state flow | Follow state machine |
| ”Schema validation failed” | Schema | Missing fields | Check UCP schema |
| ”Discount exceeds subtotal” | Discount | Over 100% off | Cap discount |
Getting Help
- GitHub Issues: github.com/QWED-AI/qwed-ucp/issues
- Documentation: docs.qwedai.com/ucp
- UCP Protocol: developers.google.com/commerce/ucp