Skip to content

Hot restart breaks keyboard input #87391

Closed

Description

@Hixie

Steps to reproduce:

  1. Create an app with a TextField.
  2. Launch the app with flutter run -d linux.
  3. Type in the text field. This works fine.
  4. Hot restart the app.
  5. Type in the text field. This fails with:
** (fwml:2822048): WARNING **: 22:35:22.785: Unable to retrieve framework response: Message is not valid JSON

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following assertion was thrown during a platform message callback:
A KeyUpEvent is dispatched, but the state shows that the physical key is not pressed. If this occurs
in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure
that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the
event: KeyUpEvent#5dafa(physicalKey: PhysicalKeyboardKey#700e7(usbHidUsage: "0x000700e7", debugName:
"Meta Right"), logicalKey: LogicalKeyboardKey#0010e(keyId: "0x10000010e", keyLabel: "Super",
debugName: "Super"), character: null, timeStamp: 1115:12:48.298000)
'package:flutter/src/services/hardware_keyboard.dart':
Failed assertion: line 441 pos 16: '_pressedKeys.containsKey(event.physicalKey)'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      HardwareKeyboard._assertEventIsRegular.<anonymous closure> (package:flutter/src/services/hardware_keyboard.dart:441:16)
#3      HardwareKeyboard._assertEventIsRegular (package:flutter/src/services/hardware_keyboard.dart:452:6)
#4      HardwareKeyboard.handleKeyEvent (package:flutter/src/services/hardware_keyboard.dart:543:5)
#5      KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:821:35)
#6      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:73:49)
#7      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:72:47)
#8      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:379:35)
#9      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:376:46)
#10     _invoke2.<anonymous closure> (dart:ui/hooks.dart:203:15)
#14     _invoke2 (dart:ui/hooks.dart:202:10)
#15     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#16     _Channel.push (dart:ui/channel_buffers.dart:132:31)
#17     ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#18     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:536:22)
#19     _dispatchPlatformMessage (dart:ui/hooks.dart:90:31)
(elided 5 frames from class _AssertionError and dart:async)
════════════════════════════════════════════════════════════════════════════════════════════════════

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    engineflutter/engine related. See also e: labels.
    P1High-priority issues at the top of the work list
    on Jul 31, 2021
  2. goderbauer commented on Aug 3, 2021

    @goderbauer
    Member
  3. Andreigr0 commented on Sep 14, 2021

    @Andreigr0

    Faced this issue on macOS (Apple M1) too on latest stable Flutter build 2.5.0

  4. gidrokolbaska commented on Sep 16, 2021

    @gidrokolbaska

    Same. Flutter 2.5.0, macos m1, throws error

  5. dkwingsmt commented on Sep 20, 2021

    @dkwingsmt
    Contributor

    This is probably fixed on master with #88967. Let me know if it still occurs. (We'll probably cherrypick the fix into the next fix version.)

  6. lordarcadius commented on Sep 20, 2021

    @lordarcadius

    @dkwingsmt Hey, I just tried it on dev channel but I am still facing the issue when I press a key on my Flutter web app!

    ════════ Exception caught by services library ══════════════════════════════════ Assertion failed: ../…/services/hardware_keyboard.dart:441 _pressedKeys.containsKey(event.physicalKey) "A KeyUpEvent is dispatched, but the state shows that the physical key is not pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in HardwareKeyboard`. This was the event: KeyUpEvent#29652(physicalKey: PhysicalKeyboardKey#700e3(usbHidUsage: "0x000700e3", debugName: "Meta Left"), logicalKey: LogicalKeyboardKey#4b191(keyId: "0x200000106", keyLabel: "Meta Left", debugName: "Meta Left"), character: null, timeStamp: 0:00:10.749000, synthesized)"

    ════════════════════════════════════════════════════════════════════════════════`

    This is the error I get.

  7. SadiqMH commented on Sep 24, 2021

    @SadiqMH

    I got the same error, but in my case, the key label is "Alt Left". It shows whenever I press any key on the keyboard, not just Alt Left.
    The app isn't crashing, but keeps throwing this error.

  8. Ali1Ammar commented on Sep 25, 2021

    @Ali1Ammar

    same error

    ** (learn:3772): CRITICAL **: 15:22:11.507: void synchronize_pressed_states_loop_body(gpointer, gpointer, gpointer): assertion 'pressed_logical_key_before_event == 0 || pressed_logical_key_before_event == logical_key' failed
    ** (learn:3772): CRITICAL **: 15:22:11.508: void synchronize_pressed_states_loop_body(gpointer, gpointer, gpointer): assertion 'pressed_logical_key_before_event == 0 || pressed_logical_key_before_event == logical_key' failed
    ** (learn:3772): WARNING **: 15:22:11.577: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    The following assertion was thrown during a platform message callback:
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    
    Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
    In either case, please report this assertion by filing a bug on GitHub:
      https://github.com/flutter/flutter/issues/new?template=2_bug.md
    
    When the exception was thrown, this was the stack
    #2      HardwareKeyboard._assertEventIsRegular.<anonymous closure>
    #3      HardwareKeyboard._assertEventIsRegular
    #4      HardwareKeyboard.handleKeyEvent
    #5      KeyEventManager.handleRawKeyMessage
    #6      BasicMessageChannel.setMessageHandler.<anonymous closure>
    #7      BasicMessageChannel.setMessageHandler.<anonymous closure>
    #8      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
    #9      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
    #10     _invoke2.<anonymous closure> (dart:ui/hooks.dart:205:15)
    #14     _invoke2 (dart:ui/hooks.dart:204:10)
    #15     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
    #16     _Channel.push (dart:ui/channel_buffers.dart:132:31)
    #17     ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
    #18     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:544:22)
    #19     _dispatchPlatformMessage (dart:ui/hooks.dart:92:31)
    (elided 5 frames from class _AssertionError and dart:async)
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:11.730: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:11.871: Unable to retrieve framework response: Message is not valid JSON
    ** (learn:3772): WARNING **: 15:22:11.932: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:12.035: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:12.063: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:12.196: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:15.700: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:15.864: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:16.948: Unable to retrieve framework response: Message is not valid JSON
    ** (learn:3772): WARNING **: 15:22:17.154: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:18.246: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:18.372: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:19.072: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:19.210: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:20.210: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:20.333: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:20.823: Unable to retrieve framework response: Message is not valid JSON
    ** (learn:3772): WARNING **: 15:22:21.031: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:21.455: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:22:21.602: Unable to retrieve framework response: Message is not valid JSON
    ** (learn:3772): WARNING **: 15:23:23.868: Unable to retrieve framework response: Message is not valid JSON
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by services library ══════════════════════════════════
    A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyUpEvent#686f4(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName: "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left", debugName: "Alt Left"), character: null, timeStamp: 0:35:21.510000) and the recorded logical key LogicalKeyboardKey#00709(keyId: "0x100000709", keyLabel: "Group Next", debugName: "Group Next")
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'
    
    ════════════════════════════════════════════════════════════════════════════════
    ** (learn:3772): WARNING **: 15:23:24.038: Unable to retrieve framework response: Message is not valid JSON
    
    
  9. jpnurmi commented on Sep 25, 2021

    @jpnurmi
    Member

    On Linux with latest Flutter master:

    • flutter create .
    • flutter run
    • Alt+Tab out
    • Shift+R to hot restart
    • Alt+Tab in
    • => Failed assertion: line 441 pos 16: '_pressedKeys.containsKey(event.physicalKey)'
    full output
    $ flutter run
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    Syncing files to device Linux...                                    66ms
    
    Flutter run key commands.
    r Hot reload. 🔥🔥🔥
    R Hot restart.
    h List all available interactive commands.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).
    
    💪 Running with sound null safety 💪
    
    An Observatory debugger and profiler on Linux is available at: http://127.0.0.1:40123/iMD5BwiwSbo=/
    The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9104?uri=http://127.0.0.1:40123/iMD5BwiwSbo=/
    
    Performing hot restart...                                               
    Restarted application in 203ms.
    
    ** (flutter_hot_restart:494224): WARNING **: 18:39:44.826: Unable to retrieve framework response: Message is not valid JSON
    
    ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
    The following assertion was thrown during a platform message callback:
    A KeyUpEvent is dispatched, but the state shows that the physical key is not pressed. If this occurs
    in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure
    that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the
    event: KeyUpEvent#e47d5(physicalKey: PhysicalKeyboardKey#700e2(usbHidUsage: "0x000700e2", debugName:
    "Alt Left"), logicalKey: LogicalKeyboardKey#00104(keyId: "0x200000104", keyLabel: "Alt Left",
    debugName: "Alt Left"), character: null, timeStamp: 41:00:37.499000, synthesized)
    'package:flutter/src/services/hardware_keyboard.dart':
    Failed assertion: line 441 pos 16: '_pressedKeys.containsKey(event.physicalKey)'
    
    Either the assertion indicates an error in the framework itself, or we should provide substantially
    more information in this error message to help you determine and fix the underlying cause.
    In either case, please report this assertion by filing a bug on GitHub:
      https://github.com/flutter/flutter/issues/new?template=2_bug.md
    
    When the exception was thrown, this was the stack:
    #2      HardwareKeyboard._assertEventIsRegular.<anonymous closure> (package:flutter/src/services/hardware_keyboard.dart:441:16)
    #3      HardwareKeyboard._assertEventIsRegular (package:flutter/src/services/hardware_keyboard.dart:452:6)
    #4      HardwareKeyboard.handleKeyEvent (package:flutter/src/services/hardware_keyboard.dart:543:5)
    #5      KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:821:35)
    #6      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:77:49)
    #7      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:76:47)
    #8      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:386:35)
    #9      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:383:46)
    #10     _invoke2.<anonymous closure> (dart:ui/hooks.dart:189:15)
    #14     _invoke2 (dart:ui/hooks.dart:188:10)
    #15     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
    #16     _Channel.push (dart:ui/channel_buffers.dart:132:31)
    #17     ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
    #18     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:544:22)
    #19     _dispatchPlatformMessage (dart:ui/hooks.dart:83:31)
    (elided 5 frames from class _AssertionError and dart:async)
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    Flutter 2.6.0-12.0.pre.89 • channel master • https://github.com/flutter/flutter.git
    Framework • revision 2f9df031fe (14 hours ago) • 2021-09-24 22:28:06 -0400
    Engine • revision 3248e8b648
    Tools • Dart 2.15.0 (build 2.15.0-147.0.dev)
    

    It's specifically Alt+Tab out plus hot restart where the keyboard state machine breaks. For example, a mouse click on the terminal, hot restart, and Alt+Tab back to the app does not trigger the error.

  10. edwardaux commented on Sep 26, 2021

    @edwardaux
    Contributor

    It's specifically Alt+Tab out plus hot restart where the keyboard state machine breaks. For example, a mouse click on the terminal, hot restart, and Alt+Tab back to the app does not trigger the error.

    💯 this is the case for me too!

  11. 79 remaining items

  12. flutter-triage-bot commented on Jul 8, 2023

    @flutter-triage-bot

    This issue is assigned but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

  13. bleroux commented on Jul 11, 2023

    @bleroux
    Contributor

    Monthly update:

    I plan to work on Windows implementation during this summer.

  14. bleroux commented on Aug 10, 2023

    @bleroux
    Contributor

    Closing this issue because the work described in #87391 (comment) has landed:

    There is still one known issue related to keyboard and hot restart, see #125975.

    For anyone still encountering keyboard related error messages.
    Multiplatform keyboard support is complex. The error messages (which are mainly warnings) could be annoying but they are helpful to isolate and fix edge cases.

    When searching existing bugs or filing a new one, thank you to answer the following questions:

  15. moved this from In Progress to Done in Flutter Desktopon Aug 10, 2023
  16. moved this from PR submitted to Done (PR merged) in Nevercodeon Aug 10, 2023
  17. added
    r: fixedIssue is closed as already fixed in a newer version
    on Aug 10, 2023
  18. github-actions commented on Aug 24, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions