Crash in PostCategory.lookup ("nil is not a valid object ID") after a quick status change from the post list
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- objective-c, swift
- Ambito
- mobile
Direzione di ricerca
Build the Jetpack scheme and use docs/simulator-sign-in.md to set up the simulator. Follow the listed steps with Network Link Conditioner, then inspect PostRepository.update, PostHelper.merge, and the PostCategory.lookup stack path to check whether the post is deleted while the PATCH is in flight. Report whether the repro is reliable and, if confirmed, the cause and a fix approach.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Likely shares a root cause with #26317, #26318, #26319, #26320. See #26323: posts are deleted locally by a first-page list sync while still in use.
Sentry: JETPACK-IOS-1JSW
Sentry snapshot (as of Oct 30, 2026)
- Fatal
NSInvalidArgumentException: nil is not a valid object ID. First seen Mar 21, 2026. 373 events from 149 users in total. - Last 30 days by release:
- 27.3: 138 events, 78 users
- 27.2: 12 events, 10 users
- 27.1: 2 events
- This got worse in 27.3. 27.3 has about 4.2× as many users reporting any error as 27.2 (2,388 vs 573 in 30 days). This crash is at about 7.8× on 27.3, so it's roughly twice as frequent per user.
- Devices: iPhone only, with no iPad events. Mostly iOS 26.3–26.6 and 27.0.x.
Stack (crashing thread)
PostCoordinator.performChanges closure (PostCoordinator.swift:252) → PostCoordinator.update (:156) → PostRepository.update (PostRepository.swift:216) → +[PostHelper updatePost:withRemotePost:inContext:overwrite:] (PostHelper.m:89) → updatePost:withRemoteCategories: (:113) → PostHelper.createOrUpdateCategory (PostHelper+Metadata.swift:42) → PostCategory.lookup (PostCategory+Lookup.swift:19) → NSManagedObjectContext existingObjectWithID: throws.
createOrUpdateCategory passes blog.objectID. The blog comes from post.blog, which is nil here. existingObject(with:) then raises an Objective-C exception, which the try? in the caller can't catch.
Breadcrumbs (6 recent 27.3 events)
In all 6, the crash happens just as a quick PATCH (POST …/posts/{id}?context=edit) returns, after the user started it from the post list:
- 3 of 6: a context-menu action from the Published tab, with an 18-byte body. That's
{"status":"draft"}, i.e. Move to Draft (PostCoordinator.moveToDraft). - 2 of 6: Publish from the Drafts tab via
PublishPostViewController, with a 20-byte body (status → publish). - 1 of 6: a Post Settings save from the list's context menu (42–98 byte body).
- In every one, the same list status (
status=publish,privateorstatus=draft,pending) was re-fetched while the PATCH was in flight. Several events show the list polling every few seconds.
Candidate cause (hypothesis, not confirmed)
- The user changes a post's status from the list. The PATCH starts, and the server applies it right away.
- The list for the old status re-syncs. The post isn't in the response anymore, so
PostRepository(purgeExisting: deleteOtherLocalPosts) →PostHelper.merge(PostHelper.m:193) deletes the local post. - The PATCH response arrives.
PostRepository.updatecallsPostHelper.update(post, …)on the deleted object.post.blogis nil, so it crashes.
Possible fixes:
- In
PostRepository.update, return early after theawaitifpost.isDeletedorpost.managedObjectContext == nil. - Make
PostHelper updatePost:withRemoteCategories:skip the update whenpost.blogis nil. - Exclude posts with an update in flight from the purge.
Why 27.3 is worse is unclear. Nothing in the 27.2→27.3 range (e7c3606158…b2234d0688) touches PostRepository, PostCoordinator or the purge. #25970 only changed PostCategoryService create, which isn't on this path. The frequent list polling seen in the breadcrumbs is worth checking.
Repro to try, in order
- Setup: a WordPress.com site with a few published posts and drafts. Use Network Link Conditioner (host) with ~3 s latency so the PATCH stays in flight.
- Move to Draft: Posts › Published › long-press a post › Move to Draft. Immediately pull to refresh the Published list.
- Publish: Posts › Drafts › context menu › Publish › confirm. Immediately pull to refresh the Drafts list.
- Repeat steps 2 and 3 about 10 times. Add an Exception breakpoint, plus a breakpoint where
PostHelper.mergedeletes posts, to confirm the post is deleted beforePostRepository.updateresumes.
Event IDs
47cf73bc5efd408f99dc69bda3765d25: Move to Draft, Published tab330d0c02d72e46858ac56b3c6cdd1e8b: Move to Draft, Published tabed467d1d01f740b2bbe4891bbbda9933: Publish from Draftsfc8a713c1270408a9933b50a00baa747: Post Settings save, then Publish from Drafts864cdb7293b8437197cecd2a7a314574: Post Settings save from the Published tab
Build the Jetpack scheme and sign in using docs/simulator-sign-in.md, with bundle ID com.automattic.jetpack.
When you're done: post the results here. If you now have reliable steps, remove [Status] Needs Repro. If you found the cause and a fix approach, remove [Status] Needs Plan and add [Status] Ready for Dev. Remove Simulator Testable when you're finished.
Generated by Claude Code
- Lingua principale
- Swift
- Stelle
- 3.9k
- Fork
- 1.2k
- Merge medio
- 1g 23h
- PR unite (30g)
- 136
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wordpress-mobile/WordPress-iOS
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Status] Ready for Dev [Type] Bug Reader
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wordpress-mobile/WordPress-iOS
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
🎉 Add RemoteCrabAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
jaywcjlove/awesome-mac#4999 ·
I maintainer di solito rispondono entro 1 giorno
-
[Type] Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
wordpress-mobile/GutenbergKit#940 ·
I maintainer di solito rispondono entro 1 giorno
-
pending-maintainer-response pending-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws-amplify/amplify-swift#4423 ·
I maintainer di solito rispondono entro 2 giorni
-
tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
erkamyaman/unslop-anything#80 ·
I maintainer di solito rispondono entro 1 giorno