Skip to content

Fix crash when the same file is passed as --attachment twice - #1550

Open
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-duplicate-attachment-unique-constraint
Open

Fix crash when the same file is passed as --attachment twice#1550
ikatyal2110 wants to merge 1 commit into
simonw:mainfrom
ikatyal2110:fix-duplicate-attachment-unique-constraint

Conversation

@ikatyal2110

Copy link
Copy Markdown
Contributor

When the same file path is given to --attachment more than once, every occurrence produces the same attachment_id (SHA-256 of file bytes). The second INSERT into prompt_attachments — whose primary key is (response_id, attachment_id) — then fails with sqlite3.IntegrityError: UNIQUE constraint failed, crashing after the model has already replied. Adding ignore=True to that insert silently drops the duplicate row and lets logging complete normally. Fixes #1354


Generated by Claude Code

… twice

When `--attachment` is given the same path more than once, all occurrences
hash to the same attachment_id. The second INSERT into prompt_attachments
(pk: response_id, attachment_id) raised `sqlite3.IntegrityError: UNIQUE
constraint failed`, crashing after the model had already responded.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled sqlite unique constraint violation when --attachment is passed twice on the same file

2 participants