Repository navigation
Description
Crashlytics issue: 8a645322288c132a10251c0540cd1f46 (iOS, FATAL)
Console: https://console.firebase.google.com/project/opencode-mobile-release/crashlytics/app/ios:dev.opencode.mobile/issues/8a645322288c132a10251c0540cd1f46
Why filed: fatal crash with 1 event on the newest iOS release build, 1.4.0 (45), and no fix merged. Crashlytics flags it SIGNAL_FRESH (first appeared today).
Exception
NSInternalInconsistencyException: Content view returned an invalid size {408, 3617166} from -systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:, which is not allowed.
The content view in the exception is a SwiftUI UIHostingContentView hosting SessionChatTimelineHostRow. At throw time its frame was (0 0; 408 120).
Stack summary (latest event)
Blamed frame: closure #1 in MessageListTimelineHostCell.preferredLayoutAttributesFitting(_:) (MessageListTimelineHostCell.swift:50). That line is fitted = super.preferredLayoutAttributesFitting(attributes), which is when UIKit asks the hosted SwiftUI row to self-size.
NSInternalInconsistencyException: Content view returned an invalid size {408, 3617166} from -systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority: which is not allowed.
at FIRCLSTerminateHandler()
at std::__terminate(void (*)())
at objc_exception_throw
at -[UICollectionViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:]
Source: ios/OpenCode Mobile/OpenCode Mobile/UI/Scroll/MessageListTimelineHostCell.swift.
Scope (Crashlytics, as of 2026-11-15 16:41 CET)
- 1 event / 1 user, 2026-11-15 15:18 CET, on 1.4.0 (45) only.
- Device: iPhone18,2, iOS 27.2.0, app in FOREGROUND.
- 1.4.0 (45) has 661 reported sessions since 2026-11-11. This is the only crash event on 45 so far.
Root-cause hypothesis
MessageListTimelineHostCell seeds a preferred height from the row-height cache, then calls super.preferredLayoutAttributesFitting. The hosted SessionChatTimelineHostRow returns a width of 408 (plausible) and a height of about 3.6 million points, which UIKit rejects as invalid and turns into an NSInternalInconsistencyException that kills the process.
A height that large usually means a SwiftUI view was measured with no useful height constraint (or at zero width, so text wraps to an enormous column). #1032 fixed a similar “measured at no width, reads far too tall” bug for bottom sheets and is already in 1.4.0 (45), so this looks like a separate residual in the message-list cell self-sizing path, not a recurrence of #1032.
Ideas
- Clamp the height returned from
preferredLayoutAttributesFitting(and/or from the hosting content view) to a sane maximum before UIKit asserts. - Find which
SessionChatTimelineHostRowcontent measures this tall (a very long message, a tool result, or a zero-width pass) and give that subtree a width/height constraint during collection-view self-sizing. - Avoid caching an invalid height into
MessageListTimelineRowHeightCacheif a later pass already produced one.
Watch: single event so far, so it may be rare. Will update if the count grows.
Filed by Crashlytics Bot.
Activity
ivanfenenko commentedon Nov 15, 2026
Reproduced, and the fix we agreed on
Cause. One message is one timeline row, and no message text has a height limit. UIKit rejects a self-sized row taller than about 2,777,777 pt (measured on a 3x simulator) and throws this exception during layout. Text wraps at the correct width; the message simply has too many lines. The zero-width measuring theory from the report was tested and ruled out.
What triggers it. Line count, not bytes:
A model cannot write that much in one reply. A user can paste it (a log, a CSV, a file dump), from any client on the same session. The session then crashes the app every time it is opened. A seeded session with a 190,000-line user message reproduced it end to end; a 100,000-line one opened normally.
Decision.
Not doing: a cell-level height clamp. With user messages capped nothing realistic reaches the limit, and a clamped row draws wrongly.
#1043 Fit cut bubbles to their text, seamless long Select text, no cr…
#1043 Render markdown in cut messages, bound whole-text passes, CRLF …
#1043 Start a cut message's shown part at its first line with content
#1043 Keep Select text open on a failed copy, CRLF chunk ends, bound …
ivanfenenko commentedon Nov 17, 2026
Crashlytics triage 2026-11-17: fix PR #1049 (d45629f) merged 2026-11-16 00:14 UTC, not yet in a release build. Issue 8a645322 now shows 2 events / 1 user, all on iOS 1.4.0 (45), iPhone18,2 iOS 27.2.0, last 2026-11-15 14:19 UTC (pre-fix; second event was received late). I'll confirm once a build containing the fix has been out 7+ days with ~50+ sessions and 0 events.