{"record":{"id":"b9c8638708710fb9","repo":"grafana/k6","slug":"attaching-iframe-target-id-v-to-session-id-v-w","errorCode":null,"errorMessage":"attaching iframe target ID %v to session ID %v: %w","messagePattern":"attaching iframe target ID (.+?) to session ID (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_session.go","lineNumber":1112,"sourceCode":"\t\treturn nil\n\t}\n\t// Remove all children of the previously attached frame.\n\terr := fs.manager.removeChildFramesRecursively(fr)\n\tif err != nil {\n\t\tfs.logger.Debugf(\"FrameSession:attachIFrameToTarget:return\",\n\t\t\t\"sid:%v tid:%v esid:%v etid:%v ebctxid:%v type:%q, can't remove child frames recursively: %q\",\n\t\t\tfs.session.ID(), fs.targetID, sid, ti.TargetID, ti.BrowserContextID, ti.Type, err)\n\t}\n\n\tnfs, err := NewFrameSession(\n\t\tfs.ctx,\n\t\tfs.teardownCtx,\n\t\tsession,\n\t\tfs.page, fs, ti.TargetID,\n\t\tfs.logger,\n\t\tfalse)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"attaching iframe target ID %v to session ID %v: %w\",\n\t\t\tti.TargetID, sid, err)\n\t}\n\n\tif err := fs.page.attachFrameSession(cdp.FrameID(ti.TargetID), nfs); err != nil {\n\t\tif errors.Is(err, errPageClosing) {\n\t\t\tfs.logger.Debugf(\"FrameSession:attachIFrameToTarget\",\n\t\t\t\t\"rejected frame; page is closing: tid=%v\", ti.TargetID)\n\t\t\tdetachSession(session)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// attachWorkerToTarget attaches a Worker target to a given session.\nfunc (fs *FrameSession) attachWorkerToTarget(ti *target.Info, session *Session) error {","sourceCodeStart":1094,"sourceCodeEnd":1130,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame_session.go#L1094-L1130","documentation":"While handling Target.attachedToTarget for an iframe, constructing the nested NewFrameSession for the iframe's target failed. The wrapped error carries the setup failure (CDP error during frame init); the attach is aborted and the iframe cannot be automated.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame_session.go:1054 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the frame-session setup failure","Check the iframe's page for crashes or unsupported features","Update k6/Chromium and retry; transient attach failures occur"],"exampleFix":null,"handlingStrategy":"try-catch","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"}