Crash in PostCategory.lookup ("nil is not a valid object ID") after a quick status change from the post list
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- objective-c, swift
- 領域
- mobile
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Swift
- スター
- 3.9k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 136
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wordpress-mobile/WordPress-iOS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
wordpress-mobile/WordPress-iOS#26423 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wordpress-mobile/WordPress-iOS#26279 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
wordpress-mobile/WordPress-iOS#26276 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
wordpress-mobile/WordPress-iOS#26256 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Status] Ready for Dev [Type] Bug Reader
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
wordpress-mobile/WordPress-iOS#26254 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
wordpress-mobile/WordPress-iOS の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
🎉 Add RemoteCrabオープン
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
jaywcjlove/awesome-mac#4999 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wordpress-mobile/GutenbergKit#940 ·
メンテナーはふだん 1 日以内に返信
-
pending-maintainer-response pending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-amplify/amplify-swift#4423 ·
メンテナーはふだん 2 日以内に返信
-
tests
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
erkamyaman/unslop-anything#80 ·
メンテナーはふだん 1 日以内に返信