{"record":{"id":"50570c5612b3adef","repo":"jackwener/OpenCLI","slug":"browser-checked-check-uncheck-is-not-su","errorCode":null,"errorMessage":"browser ${checked ? 'check' : 'uncheck'} is not supported by this browser backend","messagePattern":"browser (.+?) is not supported by this browser backend","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.ts","lineNumber":2166,"sourceCode":"      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 { matches_n, match_level } = await page.dblClick(resolvedTarget, parsed.opts);\n      console.log(JSON.stringify({ dblclicked: true, target: resolvedTarget, matches_n, match_level }, null, 2));\n    }));\n\n  const runCheckCommand = async (\n    page: Awaited<ReturnType<typeof getBrowserPage>>,\n    target: unknown,\n    opts: Record<string, unknown>,\n    checked: boolean,\n  ): Promise<void> => {\n    if (typeof page.setChecked !== 'function') throw new Error(`browser ${checked ? 'check' : 'uncheck'} is not supported by this browser backend`);\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 result = await page.setChecked(resolvedTarget, checked, parsed.opts);\n    console.log(JSON.stringify({\n      checked: result.checked,\n      changed: result.changed,\n      target: resolvedTarget,\n      matches_n: result.matches_n,\n      match_level: result.match_level,\n      ...(result.kind ? { kind: result.kind } : {}),\n    }, null, 2));\n  };","sourceCodeStart":2148,"sourceCodeEnd":2184,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/cli.ts#L2148-L2184","documentation":"Shared handler for `browser check` and `browser uncheck`; it feature-detects `page.setChecked` and throws a command-specific capability error when the backend lacks checkbox toggling support. The message names the exact command (check or uncheck) based on the `checked` flag.","triggerScenarios":"Running `browser check <target>` or `browser uncheck <target>` on a backend whose page object has no `setChecked` method.","commonSituations":"Minimal browser drivers without form-control helpers; automation adapters that expose click but not check/uncheck semantics.","solutions":["Switch to a backend implementing setChecked (Playwright/Puppeteer-based).","Use `browser click` on the checkbox as a fallback, or `browser eval` setting `element.checked` and dispatching change.","Confirm the backend config selects a driver that supports form control helpers."],"exampleFix":"// before\nbrowser --backend minimal check 'input[type=checkbox]'\n// after\nbrowser --backend playwright check 'input[type=checkbox]'","handlingStrategy":"type-guard","validationCode":"const page = await getBrowserPage();\nif (typeof page.setChecked !== 'function') {\n  throw new Error('Current backend cannot check/uncheck controls');\n}","typeGuard":"function supportsSetChecked(page) {\n  return typeof page?.setChecked === 'function';\n}","tryCatchPattern":"try {\n  await run(['browser', 'check', sel]);\n} catch (err) {\n  if (String(err.message).includes('is not supported by this browser backend')) {\n    await run(['browser', 'click', sel]);\n  } else throw err;\n}","preventionTips":["Feature-detect setChecked before check/uncheck.","Fall back to click on checkboxes/toggles when the backend lacks setChecked.","Standardize on one backend per test suite.","Verify form-control support when adding a new backend."],"tags":["browser","cli","capability"],"backgroundTag":"unsupported-browser-capability","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}