{"record":{"id":"430824204cfb978c","repo":"grafana/k6","slug":"sending-key-up-w","errorCode":null,"errorMessage":"sending key up: %w","messagePattern":"sending key up: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/keyboard.go","lineNumber":64,"sourceCode":"\t\tsession:     s,\n\t\tpressedKeys: make(map[int64]struct{}),\n\t\tlayoutName:  \"us\",\n\t\tlayout:      keyboardlayout.GetKeyboardLayout(\"us\"),\n\t}\n}\n\n// Down sends a key down message to a session target.\nfunc (k *Keyboard) Down(key string) error {\n\tif err := k.down(key); err != nil {\n\t\treturn fmt.Errorf(\"sending key down: %w\", err)\n\t}\n\treturn nil\n}\n\n// Up sends a key up message to a session target.\nfunc (k *Keyboard) Up(key string) error {\n\tif err := k.up(key); err != nil {\n\t\treturn fmt.Errorf(\"sending key up: %w\", err)\n\t}\n\treturn nil\n}\n\n// Press sends a key press message to a session target.\n// It delays the action if `Delay` option is specified.\n// A press message consists of successive key down and up messages.\nfunc (k *Keyboard) Press(key string, kbdOpts KeyboardOptions) error {\n\tif err := k.comboPress(key, kbdOpts); err != nil {\n\t\treturn fmt.Errorf(\"pressing key: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// InsertText inserts a text without dispatching key events.\nfunc (k *Keyboard) InsertText(text string) error {\n\tif err := k.insertText(text); err != nil {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/keyboard.go#L46-L82","documentation":"Wrap of Keyboard.up in the public Keyboard.Up: releases a previously pressed key by dispatching a CDP keyUp event. The wrap covers the inner failure — the key is not valid for the active layout, or the CDP Input.dispatchKeyEvent call failed due to a closed session or canceled context. Releasing a key that was never pressed is tolerated (the modifiers map is simply cleaned).","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/keyboard.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the same standard key names accepted by the layout","Ensure key up calls happen while the session is still alive — avoid async gaps after page close","Always pair down() with up() or use press() which handles both atomically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}