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 INTERNAL_VERIFICATION_ERROR
Cause: A guard raised an unexpected exception mid-verification. The Express middleware fails closed on this path — it does not call next(), and the client receives:
stderr via console.error('QWED-UCP Middleware Error:', error) — check your server logs for the stack trace.
Fix:
- Reproduce the request locally and inspect the logged exception.
- If the payload has unexpected shape (missing
currency, non-numeric amounts, etc.), tighten your upstream validation or add the field before the middleware runs. - If a specific guard is crashing, file an issue with the offending payload — do not “recover” by catching the 500 and forwarding the request.
CORS issues with middleware
Solution for FastAPI:Performance issues
Verification is slow
Optimize with caching:Common errors reference
UNPARSEABLE_REQUEST (422) from middleware
Cause: The FastAPI or Express middleware received a request on a protected path (/checkout-sessions, /checkout, /cart, /payment) that it could not parse as a JSON object, so it failed closed before running guards.
Common triggers:
- Empty body on a
POST/PUT/PATCH - Form-encoded, XML, or binary body instead of JSON
- Malformed JSON (trailing comma, unquoted key, truncated payload)
- Top-level JSON array, number, string,
null, or boolean
Content-Type: application/json:
verify_paths so the middleware skips it:
Getting help
- GitHub Issues: github.com/QWED-AI/qwed-ucp/issues
- Documentation: docs.qwedai.com/ucp
- UCP Protocol: developers.google.com/commerce/ucp