Skip to content

Mutation error (DB01003 TRANSACTION_FAILED) when editing products on demo site #489

Description

@kilbot

Description

After a recent update, editing products on the demo site frequently fails with a mutation error and the product changes don't save. A toast appears saying "product not saved" but no further diagnostic detail is surfaced.

Error Details

{
  "category": "wcpos.mutations.document",
  "errorCode": "DB01003",
  "collectionName": "products",
  "operation": "mutation",
  "documentId": 25
}

DB01003 is TRANSACTION_FAILED — see packages/utils/src/logger/error-codes.ts:64.

Where it's thrown

In packages/core/src/screens/main/hooks/mutations/use-mutation.ts:95-115, TRANSACTION_FAILED is the fallback errorCode used when:

  • The thrown error is not an rxdb error (no error.rxdb flag), OR
  • The rxdb error code doesn't match any known case in the switch

This means the underlying error reason is being swallowed — we only see the generic fallback code and not the actual cause (e.g. network failure, validation, conflict, etc.).

Reproduction

  • Open the demo site in the POS
  • Edit a product (e.g. document 25)
  • Attempt to save — mutation fails intermittently ("quite often")
  • Toast shows "product not saved" but no detail

Suspected Issues

The underlying error message is not being captured/logged with enough fidelity to diagnose. The log entry should include the original error message, stack, and rxdb code if available, so the actual cause (network failure, server-side rejection, conflict, etc.) can be identified from the logs.

Suggested Next Steps

  • Improve handleError in use-mutation.ts to always log the original error.message and error.code to the context, even when falling through to TRANSACTION_FAILED.
  • Reproduce against the demo site and capture the underlying rxdb / network error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions