Crash in PostCategory.lookup ("nil is not a valid object ID") after a quick status change from the post list
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- objective-c, swift
- Lĩnh vực
- mobile
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Swift
- Star
- 3.9k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 136
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wordpress-mobile/WordPress-iOS
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Status] Ready for Dev [Type] Bug Reader
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wordpress-mobile/WordPress-iOS
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
🎉 Add RemoteCrabĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
jaywcjlove/awesome-mac#4999 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
wordpress-mobile/GutenbergKit#940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending-maintainer-response pending-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws-amplify/amplify-swift#4423 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
erkamyaman/unslop-anything#80 ·
Maintainer thường phản hồi trong vòng 1 ngày