Events extension: SQLite error when purchasing ticket - dict type not supported for 'extra' field #1

Closed
opened 2026-01-03 16:08:09 +00:00 by padreug · 0 comments
Owner

Bug Description

When trying to purchase an event ticket, SQLite throws an error because the extra field is being passed as a Python dict instead of a JSON string.

Error Message

(sqlite3.ProgrammingError) Error binding parameter 11: type 'dict' is not supported
[SQL: INSERT INTO events.ticket (id, wallet, event, name, email, user_id, registered, paid, time, reg_timestamp, extra) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ]
[parameters: ('2582c3a4a530dd20858878129db78ec03f27dc9803431d0bd568879f1e31537d', '6b017ccd237348e5b7c8cb96bd013c71', 'hDC4DQwcggan3ooX8DJYAj', '', '', 'a10038b0d32e4fc08c4dac8145bbae4a', False, False, 1767456429, 1767456429, {'applied_promo_code': None, 'sats_paid': None, 'refund_address': None, 'refunded': False})]
(Background on this error at: https://sqlalche.me/e/14/f405)

Root Cause

The extra field is being passed as a Python dictionary:

{'applied_promo_code': None, 'sats_paid': None, 'refund_address': None, 'refunded': False}

SQLite doesn't support dict types directly - it needs to be serialized to a JSON string first.

Expected Fix

The extra field should be JSON serialized before insertion:

import json
extra_json = json.dumps(extra) if extra else None

Or the model should handle serialization automatically (e.g., using a JSON field type or a custom serializer).

Environment

  • LNbits version: v1.4.0 based (demo branch)
  • Database: SQLite
## Bug Description When trying to purchase an event ticket, SQLite throws an error because the `extra` field is being passed as a Python dict instead of a JSON string. ## Error Message ``` (sqlite3.ProgrammingError) Error binding parameter 11: type 'dict' is not supported [SQL: INSERT INTO events.ticket (id, wallet, event, name, email, user_id, registered, paid, time, reg_timestamp, extra) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ] [parameters: ('2582c3a4a530dd20858878129db78ec03f27dc9803431d0bd568879f1e31537d', '6b017ccd237348e5b7c8cb96bd013c71', 'hDC4DQwcggan3ooX8DJYAj', '', '', 'a10038b0d32e4fc08c4dac8145bbae4a', False, False, 1767456429, 1767456429, {'applied_promo_code': None, 'sats_paid': None, 'refund_address': None, 'refunded': False})] (Background on this error at: https://sqlalche.me/e/14/f405) ``` ## Root Cause The `extra` field is being passed as a Python dictionary: ```python {'applied_promo_code': None, 'sats_paid': None, 'refund_address': None, 'refunded': False} ``` SQLite doesn't support dict types directly - it needs to be serialized to a JSON string first. ## Expected Fix The `extra` field should be JSON serialized before insertion: ```python import json extra_json = json.dumps(extra) if extra else None ``` Or the model should handle serialization automatically (e.g., using a JSON field type or a custom serializer). ## Environment - LNbits version: v1.4.0 based (demo branch) - Database: SQLite
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: aiolabs/lnbits#1
No description provided.