My users have been experiencing crashes that appear to be related to calls to WatchUi.getCurrentView(). Specifically, Invalid Value and Unhandled Exception errors occur when accessing the array returned by this call, and Unexpected Type errors are raised when checking the result with instanceof.
After identifying this as a potential source of the issue, I introduced a wrapper function, getCurrentViewSafe(). In this function, I decomposed the call to WatchUi.getCurrentView() into multiple steps, validating each intermediate result and verifying types before accessing them. Despite these precautions, the app continues to crash at different points within this function.
The issue seems to be concentrated on newer devices. I have not encountered it myself on my Epix Pro Gen 2. Reported affected devices include Vivoactive 6, Fenix 8, Fenix 8 Pro, Venu 4, and Forerunner 970.
The complete source file is available here:
https://github.com/openhab/openhab-garmin/blob/Release-v1.1.3/source/user-interface/view-handling/ViewHandler.mc
An example of the relevant code is shown below, along with the corresponding errors as displayed in the ERA viewer:
52: var cwArray = WatchUi.getCurrentView() as Object;
53: 54: if( ! (cwArray instanceof Array ) ) {55: throw new GeneralException( "cwArray not an Array" );56: } 57: if( cwArray.size() != 2 ) {58: throw new GeneralException( "cwArray.size = " + cwArray.size() );59 }60: 61: var view = cwArray[0];
Although I verify that the returned value is a valid array and perform the necessary type checks beforehand, accessing it in line 61 can still trigger the following error:
Error Name: Invalid ValueOccurrences: 1First Occurrence: 2026-02-20Last Occurrence: 2026-02-20Devices: vívoactive® 6: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:61 CustomBehaviorDelegate.onTap:38
Error Name: Invalid ValueOccurrences: 3First Occurrence: 2026-02-20Last Occurrence: 2026-02-21Devices: Venu® 4 45mm / D2 Air X15: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:61 ErrorView.isShowing:50 SitemapRequestTasks.invoke:188 AsyncTaskQueue.executeTasks:119
The code continues as follows:
62: if( view != null && ! ( view instanceof WatchUi.View ) ) {
63: throw new GeneralException( "cwArray[0] not a View" );
64: }
65:
Line 62 also frequently fails with an Unexpected Type error:
Error Name: Unexpected Type ErrorOccurrences: 1First Occurrence: 2026-02-20Last Occurrence: 2026-02-20Devices: Venu® 4 45mm / D2 Air X15: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:62 ExceptionHandler.handleException:111 SitemapRequest.handleException:114 SitemapRequest.onReceive:190 SitemapRequest.makeRequest:145 SitemapRequest.start:253 OHApp.getInitialView:53
Error Name: Unexpected Type ErrorOccurrences: 41First Occurrence: 2026-02-18Last Occurrence: 2026-02-24Devices: Venu® 4 45mm / D2 Air X15: 16.28 fēnix® 8 Pro 47mm / 51mm / MicroLED / quatix® 8 Pro 47mm / 51mm: 21.25 vívoactive® 6: 16.28 fēnix® 8 47mm / 51mm / tactix® 8 47mm / 51mm / quatix® 8 47mm / 51mm: 21.25App Versions: v1.1.3Languages: deu, polBacktrace: ViewHandler.getCurrentViewSafe:62 ErrorView.isShowing:50 SitemapRequestTasks.invoke:188 AsyncTaskQueue.executeTasks:119
Error Name: Unexpected Type ErrorOccurrences: 2First Occurrence: 2026-02-23Last Occurrence: 2026-02-24Devices: fēnix® 8 47mm / 51mm / tactix® 8 47mm / 51mm / quatix® 8 47mm / 51mm: 21.25App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:62 ExceptionHandler.handleException:111 SitemapRequest.handleException:114 SitemapRequest.onReceive:190
Error Name: Unexpected Type ErrorOccurrences: 20First Occurrence: 2026-02-03Last Occurrence: 2026-02-24Devices: fēnix® 8 Pro 47mm / 51mm / MicroLED / quatix® 8 Pro 47mm / 51mm: 21.25 Venu® X1: 16.28 Forerunner® 970: 16.28 Edge® 1040 / 1040 Solar: 30.15 vívoactive® 6: 16.28 fēnix® 8 47mm / 51mm / tactix® 8 47mm / 51mm / quatix® 8 47mm / 51mm: 21.25App Versions: v1.1.3Languages: deu, fre, polBacktrace: ViewHandler.getCurrentViewSafe:62 BasePageMenuInitializationTasks.invoke:89 AsyncTaskQueue.executeTasks:119
Error Name: Unexpected Type ErrorOccurrences: 2First Occurrence: 2026-02-24Last Occurrence: 2026-02-24Devices: Venu® 4 45mm / D2 Air X15: 16.28App Versions: v1.1.3Languages: rusBacktrace: ViewHandler.getCurrentViewSafe:62 ErrorView.<globals/ErrorView/<statics>/<>get>:40 ErrorView.createOrUpdate:26 OHApp.getInitialView:76
The code then proceeds to access the array:66: var delegate = cwArray[1];67: if( delegate != null && 68: ! ( delegate instanceof WatchUi.BehaviorDelegate69: || delegate instanceof WatchUi.InputDelegate70: || delegate instanceof WatchUi.ConfirmationDelegate71: || delegate instanceof WatchUi.MenuInputDelegate72: // || delegate instanceof WatchUi.NumberPickerDelegate73: || delegate instanceof WatchUi.PickerDelegate74: || delegate instanceof WatchUi.TextPickerDelegate75: || delegate instanceof WatchUi.WatchFaceDelegate76: || delegate instanceof WatchUi.Menu2InputDelegate77: || delegate instanceof WatchUi.ViewLoopDelegate ) 78: ) {79: throw new GeneralException( "cwArray[1] not an input delegate" );80: }
Again, numerous Invalid Value errors occur when accessing the array in line 66, along with Unexpected Type errors when using instanceof.
Error Name: Invalid ValueOccurrences: 1First Occurrence: 2026-02-18Last Occurrence: 2026-02-18Devices: Venu® 4 45mm / D2 Air X15: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:66 ErrorView.isShowing:50 SitemapRequestTasks.invoke:188 AsyncTaskQueue.executeTasks:119
Error Name: Unhandled ExceptionOccurrences: 6First Occurrence: 2026-02-16Last Occurrence: 2026-02-24Devices: fēnix® 8 Pro 47mm / 51mm / MicroLED / quatix® 8 Pro 47mm / 51mm: 21.25 Venu® 4 45mm / D2 Air X15: 16.28 Venu® X1: 16.28 Forerunner® 970: 16.28 fēnix® 8 47mm / 51mm / tactix® 8 47mm / 51mm / quatix® 8 47mm / 51mm: 21.25App Versions: v1.1.3Languages: deu, polBacktrace: ViewHandler.getCurrentViewSafe:66 ExceptionHandler.handleException:111 AsyncTaskQueue.executeTasks:139
Error Name: Invalid ValueOccurrences: 1First Occurrence: 2026-02-19Last Occurrence: 2026-02-19Devices: vívoactive® 6: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:66 BasePageMenuInitializationTasks.invoke:89 AsyncTaskQueue.executeTasks:119
Error Name: Unexpected Type ErrorOccurrences: 2First Occurrence: 2026-02-19Last Occurrence: 2026-02-20Devices: Venu® 4 45mm / D2 Air X15: 16.28 vívoactive® 6: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:67 ErrorView.isShowing:50 SitemapRequestTasks.invoke:188 AsyncTaskQueue.executeTasks:119
Error Name: Unexpected Type ErrorOccurrences: 2First Occurrence: 2026-02-18Last Occurrence: 2026-02-23Devices: vívoactive® 6: 16.28App Versions: v1.1.3Languages: deuBacktrace: ViewHandler.getCurrentViewSafe:67 ExceptionHandler.handleException:111 SitemapRequest.handleException:114 SitemapRequest.onReceive:190 SitemapRequest.makeRequest:145 SitemapRequest.start:253 OHApp.getInitialView:53
Error Name: Unexpected Type ErrorOccurrences: 5First Occurrence: 2026-02-03Last Occurrence: 2026-02-23Devices: fēnix® 8 Pro 47mm / 51mm / MicroLED / quatix® 8 Pro 47mm / 51mm: 21.25 Forerunner® 970: 16.28 Edge® 1040 / 1040 Solar: 30.15 fēnix® 8 47mm / 51mm / tactix® 8 47mm / 51mm / quatix® 8 47mm / 51mm: 21.25App Versions: v1.1.3Languages: deu, fre, polBacktrace: ViewHandler.getCurrentViewSafe:67 BasePageMenuInitializationTasks.invoke:89 AsyncTaskQueue.executeTasks:119
The function then returns the array:
81:82: return cwArray as [ WatchUi.View or Null, WatchUi.InputDelegates or Null ];
In some cases, this has also resulted in Unhandled Exception errors.
Error Name: Unhandled Exception
Occurrences: 5
First Occurrence: 2026-02-16
Last Occurrence: 2026-02-22
Devices:
Venu® 4 45mm / D2 Air X15: 16.28
vívoactive® 6: 16.28
App Versions: v1.1.3
Languages: deu
Backtrace:
ViewHandler.getCurrentViewSafe:82
ExceptionHandler.handleException:111
AsyncTaskQueue.executeTasks:139
-
flocsy🤠
-
Cancel
-
Vote Up
+1
Vote Down
-
-
More
-
Cancel
Comment-
flocsy🤠
-
Cancel
-
Vote Up
+1
Vote Down
-
-
More
-
Cancel
Children