Usage of `NavigationLink` and `.navigationDestination` causing console error logs

I'm using NavigationLink(value:label:) and .navigationDestination(for:destination:) in my SwiftUI watchOS app. However navigating in the app causes the system to emit the following errors to the console:

<NavigationHostingControllerCache>: MISS at depth 1 in free stack
[NavigationHostingControllerCache_UIKit] <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x125015000> containment skipped because sourceNavigationController or destination were nil or sourceNavigationController was equal to destination
[NavigationHostingControllerCache_UIKit] Eject called for index: depth 1 in free stack

Library: SwiftUI, Subsystem: com.apple.SwiftUI , Category: Invalid Configuration

The navigation itself does work fine. I'm wondering there's something I can do to fix it or if this is an internal issue of the SwiftUI framework and cannot be addressed by me? (i.e. I can ignore this)

Replies

For my case the error and subsequent lockup/crash of WatchOS was caused by stacked use of NavigationStack i.e. The destination was rooted in a NavigationStack itself.

The fix was changing NavigationStack to NavigationView YMMV

e.g

struct CrashyView: View {

    @Binding var buttons: [WatchButton]
    @State var isRoot: Bool = true

    var body: some View {
        NavigationStack {  // <---  change to `NavigationView` to avoid error
            VStack {
                List(buttons) { button in
                    NavigationLink {
                        CrashyView(buttons: .constant(button.children), isRoot: false)  //<-- recursive stacking of `NavigationStack` is a problem
                    } label: {
                        ButtonView(button: button)
                    }
                }
            }
        }
    }
}