Skip to main content
Common issues and solutions when using QWED-UCP.

Installation issues

”No module named ‘qwed_ucp’”

Cause: Package not installed correctly Solutions:
  1. Check Python version (requires 3.10+):
  2. Install in correct environment:
  3. Verify installation:

npm install fails for Express middleware

Cause: Node.js version incompatibility Solution:

Verification failures

”Total mismatch: expected X,gotX, got Y”

Cause: Money Guard detected incorrect total calculation Debug:
Common causes:
  • Discount not subtracted
  • Tax calculated on wrong base
  • Rounding differences
Fix: Use Decimal for monetary calculations:

“Line item mismatch: qty × price ≠ line_total”

Cause: Line Items Guard detected math error Debug:
Common causes:
  • 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)
Fix:

“Invalid state transition”

Cause: State Guard detected invalid checkout flow Valid transitions:
Invalid examples:
  • completed → incomplete (can’t go back)
  • cancelled → ready_for_complete (can’t resurrect)
Fix: Follow the state machine flow properly.

Middleware issues

FastAPI middleware not intercepting requests

Check route configuration:
Check verify_paths:

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:
The response is intentional: an unverified request must not settle. The underlying exception is written to 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:
Skip unchanged checkouts:

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
Fix: Send a JSON object with Content-Type: application/json:
If your endpoint is not a checkout route, either rename it or narrow verify_paths so the middleware skips it:

Getting help

  1. GitHub Issues: github.com/QWED-AI/qwed-ucp/issues
  2. Documentation: docs.qwedai.com/ucp
  3. UCP Protocol: developers.google.com/commerce/ucp