Preview annotation attachment blocks a new chat with “stored size does not match”
What happened
After annotating in the browser preview, sending the message fails with:
Attachment 'preview-annotation-annotation_4.png' cannot be sent: stored size does not match.
The chat remains a draft and cannot be sent.
Diagnosis
The local server trace records the rejection in AttachmentClaims.claimPendingAttachments, propagating through ThreadMessageIntake.launchThread and ws.rpc.orchestration.launchThread. The failure occurs before the new thread is launched.
The installed desktop app's bundled server code checks Number(info.size) !== attachment.sizeBytes for a staged attachment and emits this exact error. This confirms that the stored attachment length differs from the submitted metadata. Why the values diverged is not yet established.
The bundled client creates preview annotation PNG attachments with the annotation ID and the captured File's size. The upload path uses the File's size, while the send path uses the draft attachment's sizeBytes and cached upload ID. Stale draft metadata or reuse of an upload after an annotation changes are possible investigation paths, not confirmed causes.
A source clone could not be obtained in this session: shell network access could not resolve GitHub, and the configured source cache is outside the writable workspace. Diagnosis used the actual installed app bundle, extracted read-only into the triage workspace.
Steps to reproduce
User-reported flow; a deterministic reproduction has not yet been verified:
- Annotate a page in the browser preview.
- Submit a new chat containing the generated preview annotation screenshot.
- Observe the size mismatch error and the chat remaining in draft.
Whether the annotation was edited repeatedly or restored from a draft remains unconfirmed.
Version
Affected desktop client: 0.0.46-nightly.20261007.2774 (from the failing trace's client resource attributes). The separately invoked npx t3 triage reports CLI version 0.0.45; this differs from the affected desktop app.
Environment
macOS darwin arm64 25.6.0; triage CLI Node v26.8.2. Trace identifies Electron mode and the T3 Code Nightly desktop backend. The exact local/remote connection choice remains to be confirmed.
Evidence
AttachmentClaimError: Attachment 'preview-annotation-annotation_4.png' cannot be sent: stored size does not match.
at apps/server/dist/binCli-B1BXFBib.mjs:245754:66
at AttachmentClaims.claimPendingAttachments
at ThreadMessageIntake.launchThread
at ws.rpc.orchestration.launchThread
service.mode: electron
service.version: 0.0.46-nightly.20261007.2774
The initial trace search contained multiple failures with this same attachment name. No screenshot contents, credentials, or home directory paths are included.
Related issues
Public searches found no exact match. GitHub's direct issue search was unavailable in this session, so this is not an exhaustive duplicate check. The newer nightly 0.0.46-nightly.20261007.2787 release notes list no matching attachment or annotation fix: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261007.2787
Fix applied or workaround
No fix applied and no database writes performed. Suggested recovery, not yet tested: save the annotation screenshot, remove the failing attachment, and attach the saved image as a fresh upload. If necessary, retain the annotation details as text and send without the screenshot.
Filed by
Prepared by Codex (GPT-6) via t3 triage.
[!NOTE] Grok responding on behalf of Julius.
Thanks for the detailed trace. I didn't reproduce this end to end, but reading the code on current main (26285ab) turns up a concrete path that produces this exact error. Bug confirmed in code.
What the server checks
- The upload endpoint only stores a pending file when the body length equals the size declared at mint time (AttachmentUpload.ts#L154-L158, #L197-L201).
- So when the claim fails (AttachmentClaims.ts#L99-L112), the client sent an upload id together with
sizeBytestaken from a different File.
How the client can pair them wrongly
- Annotation ids repeat. The picker preload numbers annotations with a module-level counter,
annotation_<n>(PickPreload.ts#L137, #L225-L228, #L1389). The preload is attached to the preview webview (preview.ts#L317) and preloads normally re-run on each page load, so the counter should restart after a navigation or reload, and in each new tab. Elements, strokes and regions share the same counter. - The screenshot's attachment id is the annotation id. The image goes into the draft with
id: annotation.idandsizeBytes: file.size(PreviewView.tsx#L784-L798, previewAnnotation.ts#L25). - Upload state is keyed only by that id. The upload queue keeps one in-memory map,
uploadsByImageId, for the whole app, not per draft (attachmentUploadQueue.ts#L36-L42).startAttachmentUploadreturns early when the id already has areadyupload in the same environment (#L420-L428).getUploadedAttachmentsthen pairs that old upload id with the current image'ssizeBytes(#L615-L634). Both the send path (ChatView.tsx#L9279-L9298) and the composer effect (ChatComposer.tsx#L2038-L2042) go through it. - A ready entry can outlive its image. Deleting an annotation chip from the composer text removes the annotation and its image from the draft (composerDraftStore.ts#L3941), but on purpose leaves the upload entry in place for undo (ChatComposer.tsx#L3773-L3776). Nothing I found releases it afterwards. A second unsent draft in the same environment that holds an
annotation_<n>screenshot also keeps its entryready.
Likely sequence: you annotate, which uploads annotation_4. That annotation is then deleted from the text, or it sits in another draft. The preview page reloads or navigates, and a new annotation gets annotation_4 again. That new image is never uploaded, and the send submits the old upload id with the new crop's size. Retrying gives the same result, which fits the repeated failures with the same name in your trace. I haven't confirmed that this is exactly what you did.
Not a recent regression: the counter, the undo retention and the early return were all already on main in mid-September (4fed6cfb3, #11265). The last two weeks of attachment and preview commits don't change this logic.
Fix direction
- Give annotations ids that are unique across page loads, for example a random suffix in
nextId. - Also make the queue defensive: only reuse a
readyupload when it belongs to the same File (store the size or File identity on the ready state and re-upload if it differs). - Release retained annotation uploads once undo can no longer restore them.
Workaround (untested)
- If the composer shows the screenshot with its own remove button, use it. That path calls
releaseAttachmentUpload(ChatComposer.tsx#L3049-L3054) and clears the stale entry. - Then annotate again without reloading the preview page.
- Reloading the T3 Code window also clears the in-memory upload map.
Related: #10366 (picker drops the screenshot after a capture timeout) is nearby but a different problem. Closed #12267 and #6242 dealt with screenshots not attaching at all. Open #15205 and #15209 are about file size limits and don't touch this path.
Human here. Reproduces for me too
[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. One part of this is fixed on main in #14360. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: The upload queue can still reuse a ready upload by image ID without checking size. If that part still matters to you, please open a new issue for that part only.