{"record":{"id":"b1af290cf97db25d","repo":"jackwener/OpenCLI","slug":"browser-bridge-does-not-support-reference-drag-and","errorCode":null,"errorMessage":"Browser Bridge does not support Reference drag-and-drop","messagePattern":"Browser Bridge does not support Reference drag-and-drop","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":1186,"sourceCode":"\n  // Uploading while the persistent composer retained a video state can leave\n  // the library open beside Start/End Frame slots. Reassert image mode before\n  // assigning image-generation references; End Frame intentionally stays in\n  // the manual video composer.\n  if (slot !== 'end') {\n    await ensureImageComposer(page);\n    await openImagePanel(page);\n  }\n\n  const label = slot === 'style'\n    ? 'Style References'\n    : slot === 'end'\n      ? 'End Frame'\n      : slot === 'image'\n        ? 'Image Prompts'\n        : 'Omni Reference';\n  if (slot === 'omni' && selected.length !== 1) throw new ArgumentError('Omni Reference accepts exactly one local image');\n  if (typeof page.drag !== 'function') throw new CommandExecutionError('Browser Bridge does not support Reference drag-and-drop');\n  for (const url of selected) {\n    await markReferenceTarget(page, url, label);\n    await page.drag('[data-opencli-ref-source=\"1\"]', '[data-opencli-ref-target=\"1\"]');\n    await page.wait(0.8);\n    await verifyReferenceTarget(page, label);\n  }\n  return selected;\n}\n\nfunction normalizeButtonText(value) {\n  return String(value || '').replace(/\\s+/g, ' ').trim();\n}\n\nexport async function clickCreationAction(page, text, occurrence = 0) {\n  const target = unwrapEvaluateResult(await page.evaluate((label, wantedIndex) => {\n    const visible = (element) => {\n      const rect = element.getBoundingClientRect();\n      const style = getComputedStyle(element);","sourceCodeStart":1168,"sourceCodeEnd":1204,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L1168-L1204","documentation":"CommandExecutionError thrown when the connected browser Bridge page object lacks a page.drag function. Reference upload via drag-and-drop requires the Bridge to expose drag support.","triggerScenarios":"Using a Bridge client/older version whose page wrapper does not implement drag; passing a plain puppeteer Page (which has no .drag) instead of the Bridge-wrapped page.","commonSituations":"Outdated browser Bridge extension; mixing libraries (raw puppeteer page); custom page mock in tests without a drag stub.","solutions":["Update the Browser Bridge extension/client to a version that supports page.drag.","Ensure you pass the Bridge-wrapped page object, not a raw puppeteer Page.","Use the fallback file-input upload path (which dispatches events via evaluate).","Polyfill drag in tests by stubbing page.drag."],"exampleFix":"// before\nawait uploadReferencesToSlot(rawPuppeteerPage, paths, 'style');\n// after\nconst page = await bridge.attach(tabId);\nif (typeof page.drag !== 'function') throw new Error('Bridge drag support required');\nawait uploadReferencesToSlot(page, paths, 'style');","handlingStrategy":"type-guard","validationCode":"if (typeof page.drag !== 'function') {\n  console.warn('Bridge drag unavailable; using file-input fallback');\n}","typeGuard":"function supportsDrag(page) { return typeof page?.drag === 'function'; }","tryCatchPattern":"try {\n  await uploadReferencesToSlot(page, paths, 'style');\n} catch (err) {\n  if (String(err.message).includes('drag-and-drop')) {\n    await fallbackUploadViaFileInput(page, paths);\n  } else throw err;\n}","preventionTips":["Check page.drag before choosing the upload path","Keep the Browser Bridge updated","Avoid passing raw puppeteer pages","Implement a file-input fallback path"],"tags":["midjourney","browser-bridge","compatibility","api-capability"],"backgroundTag":"bridge-capability-missing","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}