Skip to content

fix(macos): pin VNRecognizeTextRequest to Revision 2 to avoid macOS 26 crash - #6948

Closed
keishingu wants to merge 4 commits into
BasedHardware:mainfrom
keishingu:fix/macos26-ocr-crash-empty-array
Closed

keishingu wants to merge 4 commits into
BasedHardware:mainfrom
keishingu:fix/macos26-ocr-crash-empty-array

Conversation

@keishingu

@keishingu keishingu commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • VNRecognizeTextRequestRevision3 crashes internally with EXC_BREAKPOINT (_assertionFailure) — confirmed on macOS 15.4.1 and macOS 26, so this is a bug in Revision 3 itself, not a macOS 26-specific regression
  • The crash happens in __EmptyArrayStorage._objectAt via ObjC bridge — no app code appears in the faulting thread's stack, confirming this is an Apple regression in VNRecognizeTextRequestRevision3
  • Fix: pin VNRecognizeTextRequest.revision to VNRecognizeTextRequestRevision2, which avoids the broken code path while retaining acceptable OCR quality on our macOS 14+ deployment target

Fixes #6944

Crash details

Faulting thread (no app frames — pure Apple internal crash):

_assertionFailure(_:_:file:line:flags:)
__EmptyArrayStorage._objectAt(_:)
@objc __SwiftNativeNSArrayWithContiguousStorage.objectAtSubscript(_:)
TextRecognition (internal frames)
-[VNRecognizeTextRequest internalPerformRevision:inContext:error:]

App code (waiting for Vision to finish):

VNImageRequestHandler.performRequests(...)
closure #2 in RewindOCRService.extractTextWithBounds(from:)
RewindIndexer.processFrame(...)

Test plan

  • Build and run on macOS 15 or macOS 26 — app should stay running past the previous crash window
  • Confirm OCR screen indexing still works (search for recently viewed text in Rewind)
  • Verify no regression (Revision 2 is available since macOS 10.15)

🤖 Generated with Claude Code

keishingu and others added 2 commits April 22, 2026 21:16
On macOS 26, TextRecognition.framework runs internal work on Swift
cooperative threads. When recognitionLanguages is restricted to
["en-US"] and certain screen content is processed, the framework
calls objectAtSubscript:0 on a Swift-bridged NSArray that resolves to
__EmptyArrayStorage, triggering _assertionFailure / EXC_BREAKPOINT.

Replace the fixed language list with automaticallyDetectsLanguage=true
(available since macOS 13, within our macOS 14 deployment target).
Also wrap handler creation and perform in autoreleasepool to ensure
Vision ObjC objects are released before cooperative tasks outlive them.

Fixes BasedHardware#6944

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…6 crash

VNRecognizeTextRequestRevision3 has a regression on macOS 26 where its
internal Swift Cooperative thread (com.apple.root.utility-qos.cooperative)
crashes with EXC_BREAKPOINT inside __EmptyArrayStorage._withVerbatimBridgedUnsafeBuffer.
No app code appears in the faulting thread — this is a bug inside Apple's
TextRecognition.framework for that revision.

Pinning to VNRecognizeTextRequestRevision2 avoids the broken code path
while retaining acceptable OCR quality on our macOS 14+ deployment target.

Also reverts the incorrect automaticallyDetectsLanguage hypothesis from
the previous commit — the root cause was the revision, not the language list.

Fixes BasedHardware#6944

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR works around an Apple-internal EXC_BREAKPOINT crash in VNRecognizeTextRequestRevision3 on macOS 26 by unconditionally pinning VNRecognizeTextRequest.revision to VNRecognizeTextRequestRevision2. The change is a single-line, well-commented fix that is safe on all supported deployment targets (macOS 14+, where Revision 2 has been available since macOS 10.15).

Confidence Score: 5/5

Safe to merge — targeted one-line workaround with clear justification and no risk to existing functionality.

All findings are P2 (changelog wording and a TODO suggestion). The code change itself is minimal, correct, and well-documented. Revision 2 is universally available on the supported deployment target.

No files require special attention.

Important Files Changed

Filename Overview
desktop/Desktop/Sources/Rewind/Core/RewindOCRService.swift Pins VNRecognizeTextRequest revision to Revision 2 with a thorough explanatory comment; change is minimal, well-scoped, and safe on macOS 14+.
desktop/CHANGELOG.json Changelog entry added for the crash fix; description slightly understates the root cause (Apple internal Revision 3 regression vs. content-conditional assertion).

Sequence Diagram

sequenceDiagram
    participant App as RewindOCRService
    participant VN as VNImageRequestHandler
    participant R2 as VNRecognizeTextRequestRevision2
    participant R3 as VNRecognizeTextRequestRevision3 (macOS 26 — broken)

    Note over App,R3: Before fix
    App->>VN: perform([request]) — default revision (Revision 3 on macOS 26)
    VN->>R3: dispatch to cooperative thread
    R3-->>App: EXC_BREAKPOINT (_assertionFailure in __EmptyArrayStorage)

    Note over App,R2: After fix
    App->>App: request.revision = VNRecognizeTextRequestRevision2
    App->>VN: perform([request]) — pinned to Revision 2
    VN->>R2: dispatch (no cooperative threading issue)
    R2-->>App: OCRResult(fullText, blocks)
Loading

Reviews (1): Last reviewed commit: "fix(macos): pin VNRecognizeTextRequest t..." | Re-trigger Greptile

Comment thread desktop/CHANGELOG.json Resolved
keishingu and others added 2 commits April 22, 2026 22:17
VNRecognizeTextRequestRevision3 crashes identically on macOS 15.4.1
(same __EmptyArrayStorage._objectAt assertion failure), confirming this
is a bug in Revision 3 itself, not a macOS 26-specific regression.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@beastoin

Copy link
Copy Markdown
Collaborator

i am using macOS 26.3.1 and that issue has not happened to me.

can you share the link that confirms the issue with VNRecognizeTextRequest?

@keishingu

@beastoin beastoin closed this May 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @keishingu 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS Desktop] Crash in RewindOCRService on macOS 26 — empty array access in TextRecognition framework

2 participants