{"record":{"id":"67ef7adc55e0fad4","repo":"grafana/k6","slug":"unexpected-dom-error-type-t","errorCode":null,"errorMessage":"unexpected DOM error type %T","messagePattern":"unexpected DOM error type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1873,"sourceCode":"\t\treturn true, nil // Continue retrying after delay\n\t}\n}\n\nfunc errorFromDOMError(v any) error {\n\tvar (\n\t\terr  error\n\t\tserr string\n\t)\n\tswitch e := v.(type) {\n\tcase string:\n\t\tserr = e\n\tcase error:\n\t\tif e == nil {\n\t\t\treturn errors.New(\"DOM error is nil\")\n\t\t}\n\t\terr, serr = e, e.Error()\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected DOM error type %T\", v)\n\t}\n\tif _, ok := errors.AsType[*k6ext.UserFriendlyError](err); ok {\n\t\treturn err\n\t}\n\tif strings.Contains(serr, \"timed out\") {\n\t\treturn &k6ext.UserFriendlyError{\n\t\t\tErr: ErrTimedOut,\n\t\t}\n\t}\n\tif s := \"error:expectednode:\"; strings.HasPrefix(serr, s) {\n\t\treturn fmt.Errorf(\"expected node but got %s\", strings.TrimPrefix(serr, s))\n\t}\n\n\tif serr == \"error:notconnected\" {\n\t\treturn ErrElementNotAttachedToDOM\n\t}\n\n\tif errors.Is(err, ErrElementNotVisible) {","sourceCodeStart":1855,"sourceCodeEnd":1891,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/element_handle.go#L1855-L1891","documentation":"Returned by errorFromDOMError when the value it receives from the injected script error channel is neither a string nor an error (e.g. nil, a number, or an arbitrary object). It is a defensive default branch: the DOM error propagation contract was violated, and the value's Go type is reported since no message can be extracted.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle.go:1869 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as a k6 browser module bug with a reproducing script","Check that the injected script bundle matches the k6 version","Retry in case of a transient serialization anomaly in the CDP channel"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}