{"record":{"id":"128f4e5cff91ceca","repo":"jackwener/OpenCLI","slug":"browser-upload-is-not-supported-by-this-browser-ba","errorCode":null,"errorMessage":"browser upload is not supported by this browser backend","messagePattern":"browser upload is not supported by this browser backend","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.ts","lineNumber":2214,"sourceCode":"  addBrowserTabOption(\n    addSemanticLocatorOptions(browser.command('uncheck'))\n      .argument('[target]', 'Numeric ref (from browser state / find), CSS selector, or omit when using --role/--name/etc.')\n      .option('--nth <n>', 'When <target> is a multi-match CSS selector, pick the nth match (0-based)')\n      .description('Ensure a checkbox/aria-checked control is unchecked — JSON envelope {checked, changed, target, matches_n}'),\n  )\n    .action(browserAction(async (page, target, opts) => {\n      await runCheckCommand(page, target, opts ?? {}, false);\n    }));\n\n  addBrowserTabOption(\n    addSemanticLocatorOptions(browser.command('upload'))\n      .argument('[targetOrFile]', 'Numeric ref/CSS target, or first file when using --role/--name/etc.')\n      .argument('[files...]', 'Local file path(s) to attach')\n      .option('--nth <n>', 'When <target> is a multi-match CSS selector, pick the nth match (0-based)')\n      .description('Attach local files to a file input — JSON envelope {uploaded, files, file_names, target, matches_n}'),\n  )\n    .action(browserAction(async (page, targetOrFile, files, opts) => {\n      if (typeof page.uploadFiles !== 'function') throw new Error('browser upload is not supported by this browser backend');\n      const hasSemantic = !!semanticLocatorFromOptions(opts ?? {});\n      const target = hasSemantic ? undefined : targetOrFile;\n      const resolvedTarget = await resolveWriteTargetOrPrint(page, target, opts ?? {});\n      if (!resolvedTarget) return;\n      const parsed = nthToResolveOpts(opts?.nth);\n      if ('error' in parsed) {\n        console.log(JSON.stringify({ error: { code: 'usage_error', message: parsed.error } }, null, 2));\n        process.exitCode = EXIT_CODES.USAGE_ERROR;\n        return;\n      }\n      const rawFiles = hasSemantic\n        ? [targetOrFile, ...(Array.isArray(files) ? files : [])].filter((value) => value !== undefined)\n        : files;\n      const resolvedFiles = resolveUploadFilePaths(rawFiles);\n      if ('error' in resolvedFiles) {\n        console.log(JSON.stringify({ error: resolvedFiles.error }, null, 2));\n        process.exitCode = EXIT_CODES.USAGE_ERROR;\n        return;","sourceCodeStart":2196,"sourceCodeEnd":2232,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/cli.ts#L2196-L2232","documentation":"The `browser upload` command feature-detects `page.uploadFiles`; when the backend cannot attach files to file inputs it throws this capability error. Uploading requires driver-level file chooser support that minimal backends do not provide.","triggerScenarios":"Running `browser upload <target> <files...>` against a backend without `page.uploadFiles`.","commonSituations":"Headless minimal drivers, remote sessions where file transfer is unsupported, or adapters lacking setInputFiles-equivalent functionality.","solutions":["Use a backend that supports file uploads (e.g. Playwright setInputFiles).","Set the input value via `browser eval` where feasible (works only for non-protected cases).","Verify the target page/file input is accessible and the backend config supports uploads."],"exampleFix":"// before\nbrowser --backend minimal upload '#file-input' ./doc.pdf\n// after\nbrowser --backend playwright upload '#file-input' ./doc.pdf","handlingStrategy":"type-guard","validationCode":"const page = await getBrowserPage();\nif (typeof page.uploadFiles !== 'function') {\n  throw new Error('Current backend cannot upload files');\n}","typeGuard":"function supportsUpload(page) {\n  return typeof page?.uploadFiles === 'function';\n}","tryCatchPattern":"try {\n  await run(['browser', 'upload', sel, filePath]);\n} catch (err) {\n  if (String(err.message).includes('upload is not supported')) {\n    console.error('Backend cannot upload files; switch to a Playwright/Puppeteer-backed session');\n  } else throw err;\n}","preventionTips":["Feature-detect uploadFiles before uploads.","Use backends with setInputFiles-style support for file workflows.","Confirm file paths exist and are readable before upload.","Skip upload steps in CI when the backend lacks the capability."],"tags":["browser","cli","capability","file-upload"],"backgroundTag":"unsupported-browser-capability","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}