{"record":{"id":"87e72f4b84ddf81e","repo":"openclaw/openclaw","slug":"inputref-or-element-is-required","errorCode":null,"errorMessage":"inputRef or element is required","messagePattern":"inputRef or element is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extensions/browser/src/browser/pw-tools-core.interactions.content.ts","lineNumber":435,"sourceCode":"  opts: NavigationTargetOptions & {\n    inputRef?: string;\n    element?: string;\n    paths: string[];\n  },\n): Promise<void> {\n  const page = await getPageForTargetId(opts);\n  ensurePageState(page);\n  restoreRoleRefsForTarget({ cdpUrl: opts.cdpUrl, targetId: opts.targetId, page });\n  if (!opts.paths.length) {\n    throw new Error(\"paths are required\");\n  }\n  const inputRef = normalizeOptionalString(opts.inputRef) ?? \"\";\n  const element = normalizeOptionalString(opts.element) ?? \"\";\n  if (inputRef && element) {\n    throw new Error(\"inputRef and element are mutually exclusive\");\n  }\n  if (!inputRef && !element) {\n    throw new Error(\"inputRef or element is required\");\n  }\n\n  const locator = inputRef ? refLocator(page, inputRef) : page.locator(element).first();\n  const resolvedResult = await resolveStrictExistingUploadPaths({ requestedPaths: opts.paths });\n  if (!resolvedResult.ok) {\n    throw new Error(resolvedResult.error);\n  }\n  const resolvedPaths = resolvedResult.paths;\n\n  try {\n    await awaitNavigationGuardedInteraction({\n      action: async () => {\n        await locator.setInputFiles(resolvedPaths);\n      },\n      cdpUrl: opts.cdpUrl,\n      page,\n      ...interactionNavigationPolicy(opts),\n      targetId: opts.targetId,","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/browser/src/browser/pw-tools-core.interactions.content.ts#L417-L453","documentation":"Thrown by setInputFilesViaPlaywright (extensions/browser/src/browser/pw-tools-core.interactions.content.ts:435) when neither inputRef nor element is provided. The helper has no way to locate the target input.","triggerScenarios":"Calling setInputFiles with paths only and no target selector of any kind.","commonSituations":"Agent assumed the focused element would be used; omitted both fields by mistake.","solutions":["Pass either inputRef (preferred) or a CSS element selector.","Capture the input's ref from a snapshot first.","Validate at least one target identifier is present before calling."],"exampleFix":"// before\nawait setInputFiles({ paths });\n// after\nawait setInputFiles({ inputRef: 'r3', paths });","handlingStrategy":"validation","validationCode":"const inputRef = normalizeOptionalString(opts.inputRef) ?? '';\nconst element = normalizeOptionalString(opts.element) ?? '';\nif (!inputRef && !element) {\n  throw new Error(\"setInputFiles: pass inputRef or element to locate the file input\");\n}\nawait setInputFilesViaPlaywright(opts);","typeGuard":"function hasUploadTarget(opts): boolean {\n  return Boolean(opts.inputRef) || Boolean(opts.element);\n}","tryCatchPattern":null,"preventionTips":["Capture the input's ref from a snapshot before uploading.","Always provide one of inputRef or element."],"tags":["browser","upload","validation","required-arg"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}