diff --git a/.changeset/fruity-clowns-pick.md b/.changeset/fruity-clowns-pick.md new file mode 100644 index 000000000..47dc40621 --- /dev/null +++ b/.changeset/fruity-clowns-pick.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +fix: don't attach to targets twice diff --git a/packages/core/lib/v3/understudy/context.ts b/packages/core/lib/v3/understudy/context.ts index d5d8ae171..1d309efbb 100644 --- a/packages/core/lib/v3/understudy/context.ts +++ b/packages/core/lib/v3/understudy/context.ts @@ -415,6 +415,7 @@ export class V3Context { const targets = await this.conn.getTargets(); for (const t of targets) { + if (t.attached) continue; // auto-attach already handled this target try { await this.conn.attachToTarget(t.targetId); } catch {