Cannot list communications #59

Closed
opened 2026-06-23 15:37:01 +00:00 by eliribble · 5 comments
Owner

Seen in staging:

Jun 22 21:26:52 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:26PM ERR more than one contact ID found for communication. This indicates a failure in our SQL query and will lead to subtle bugs. row.ID (communication_id)=221
Jun 22 21:26:52 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:26PM WRN Responding with an error from api error="500: hydrated communication: No contact for communication 221" status=500 user message="hydrated communication: No contact for communication 221"
Jun 22 21:27:08 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:27PM ERR more than one contact ID found for communication. This indicates a failure in our SQL query and will lead to subtle bugs. row.ID (communication_id)=221
Jun 22 21:27:08 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:27PM WRN Responding with an error from api error="500: hydrated communication: No contact for communication 221" status=500 user message="hydrated communication: No contact for communication 221"
Seen in staging: ``` Jun 22 21:26:52 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:26PM ERR more than one contact ID found for communication. This indicates a failure in our SQL query and will lead to subtle bugs. row.ID (communication_id)=221 Jun 22 21:26:52 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:26PM WRN Responding with an error from api error="500: hydrated communication: No contact for communication 221" status=500 user message="hydrated communication: No contact for communication 221" Jun 22 21:27:08 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:27PM ERR more than one contact ID found for communication. This indicates a failure in our SQL query and will lead to subtle bugs. row.ID (communication_id)=221 Jun 22 21:27:08 nocix-amd-legacy-quadcore nidus-sync[550998]: 9:27PM WRN Responding with an error from api error="500: hydrated communication: No contact for communication 221" status=500 user message="hydrated communication: No contact for communication 221" ```
Author
Owner

From staging database:

          created           | id  | organization_id | response_email_log_id | response_text_log_id | source_email_log_id | source_report_id | source_text_log_id | status
----------------------------+-----+-----------------+-----------------------+----------------------+---------------------+------------------+--------------------+--------
 2026-06-17 22:33:35.801872 | 221 |               4 |                       |                      |                     |                  |                 29 | new
From staging database: ``` created | id | organization_id | response_email_log_id | response_text_log_id | source_email_log_id | source_report_id | source_text_log_id | status ----------------------------+-----+-----------------+-----------------------+----------------------+---------------------+------------------+--------------------+-------- 2026-06-17 22:33:35.801872 | 221 | 4 | | | | | 29 | new ```
Author
Owner
nidus-sync=> select * from comms.text_log where id=29;
 content |          created           | destination  | id | is_welcome |  origin  |    source    | twilio_sid | twilio_status | is_visible_to_llm | deleted
---------+----------------------------+--------------+----+------------+----------+--------------+------------+---------------+-------------------+---------
 yes     | 2026-06-17 22:33:32.443023 | +14807704499 | 29 | f          | customer | +18016984649 |            |               | f                 |
``` nidus-sync=> select * from comms.text_log where id=29; content | created | destination | id | is_welcome | origin | source | twilio_sid | twilio_status | is_visible_to_llm | deleted ---------+----------------------------+--------------+----+------------+----------+--------------+------------+---------------+-------------------+--------- yes | 2026-06-17 22:33:32.443023 | +14807704499 | 29 | f | customer | +18016984649 | | | f | ```
Author
Owner

Well, there's your problem:

nidus-sync=> select * from comms.contact_phone;
 contact_id |     e164     | is_subscribed | id  |          deleted
------------+--------------+---------------+-----+----------------------------
          7 | +18016984649 | f             |   1 |
          4 | +13055630430 | f             |   2 |
          1 | +14807704499 | f             |   0 |
          1 | +18016984649 | f             | 159 |
        129 | +13853097382 | f             | 233 |
        128 | +13853097283 | f             |   9 | 2026-06-22 21:26:16.195151
Well, there's your problem: ``` nidus-sync=> select * from comms.contact_phone; contact_id | e164 | is_subscribed | id | deleted ------------+--------------+---------------+-----+---------------------------- 7 | +18016984649 | f | 1 | 4 | +13055630430 | f | 2 | 1 | +14807704499 | f | 0 | 1 | +18016984649 | f | 159 | 129 | +13853097382 | f | 233 | 128 | +13853097283 | f | 9 | 2026-06-22 21:26:16.195151 ```
Author
Owner

Okay, actions taken in staging:

nidus-sync=> delete from comms.contact_phone where id=159;
DELETE 1
Okay, actions taken in staging: ``` nidus-sync=> delete from comms.contact_phone where id=159; DELETE 1 ```
Author
Owner

In production we had:

nidus-sync=# select * from comms.contact_phone where contact_id=1;
 contact_id |     e164     | is_subscribed | id  | deleted
------------+--------------+---------------+-----+---------
          1 | +15594298435 | f             | 221 |
          1 | +18016984649 | f             | 222 |
          1 | +15593720139 | f             | 223 |
(3 rows)
nidus-sync=# delete from comms.contact_phone where id=222;
DELETE 1
nidus-sync=# delete from comms.contact_phone where id=223;
DELETE 1

Looks like 15593720139 was the old Delta Nidus number back when we allocated per-district phone numbers.

In production we had: ``` nidus-sync=# select * from comms.contact_phone where contact_id=1; contact_id | e164 | is_subscribed | id | deleted ------------+--------------+---------------+-----+--------- 1 | +15594298435 | f | 221 | 1 | +18016984649 | f | 222 | 1 | +15593720139 | f | 223 | (3 rows) nidus-sync=# delete from comms.contact_phone where id=222; DELETE 1 nidus-sync=# delete from comms.contact_phone where id=223; DELETE 1 ``` Looks like 15593720139 was the old Delta Nidus number back when we allocated per-district phone numbers.
Sign in to join this conversation.
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
Gleipnir/nidus-sync#59
No description provided.