Skip to content

fix: avoid FOREIGN KEY constraint crash when upserting parent message - #6725

Open
mahibi wants to merge 1 commit into
masterfrom
fixForgeinKeyConstraintException
Open

mahibi wants to merge 1 commit into
masterfrom
fixForgeinKeyConstraintException

Conversation

@mahibi

@mahibi mahibi commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

upsertParentMessage inserted into ChatMessages before the conversation row necessarily existed, unlike the sibling upsertChatMessagesAndDeleteTemp call which already swallows this exact race. Catch and log SQLiteConstraintException here too so a stale/missing conversation no longer crashes the app; the insurance request will pick it up once the conversation exists locally.

馃弫 Checklist

  • 鉀戯笍 Tests (unit and/or integration) are included or not needed
  • 馃敄 Capability is checked or not needed
  • 馃敊 Backport requests are created or not needed: /backport to stable-xx.x
  • 馃搮 Milestone is set
  • 馃尭 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

upsertParentMessage inserted into ChatMessages before the conversation
row necessarily existed, unlike the sibling upsertChatMessagesAndDeleteTemp
call which already swallows this exact race. Catch and log
SQLiteConstraintException here too so a stale/missing conversation no
longer crashes the app; the insurance request will pick it up once the
conversation exists locally.

Assisted-by: Claude Code:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi added this to the 25.1.0 milestone Sep 19, 2026
@mahibi mahibi self-assigned this Sep 19, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label Sep 19, 2026
@mahibi

mahibi commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable-25.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant