{"record":{"id":"1fd65dc4e03f712e","repo":"GopeedLab/gopeed","slug":"missing-or-invalid-text","errorCode":null,"errorMessage":"missing or invalid \"text\"","messagePattern":"missing or invalid \"text\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/download/extension_runtime_webview.go","lineNumber":181,"sourceCode":"\t})\n\t_ = obj.Set(\"click\", func(call goja.FunctionCall) goja.Value {\n\t\tselector, err := requireStringArg(call, 0, \"selector\")\n\t\tif err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\tif err := page.Click(selector, optionalMap(call.Argument(1))); err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\treturn goja.Undefined()\n\t})\n\t_ = obj.Set(\"type\", func(call goja.FunctionCall) goja.Value {\n\t\tselector, err := requireStringArg(call, 0, \"selector\")\n\t\tif err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\ttext, err := requireStringArg(call, 1, \"text\")\n\t\tif err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\tif err := page.Type(selector, text, optionalMap(call.Argument(2))); err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\treturn goja.Undefined()\n\t})\n\t_ = obj.Set(\"waitForSelector\", func(call goja.FunctionCall) goja.Value {\n\t\tselector, err := requireStringArg(call, 0, \"selector\")\n\t\tif err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}\n\t\tresult, err := page.WaitForSelector(\n\t\t\tselector,\n\t\t\toptionalMap(call.Argument(1)),\n\t\t)\n\t\tif err != nil {\n\t\t\tpanic(vm.ToValue(err))\n\t\t}","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/GopeedLab/gopeed/blob/7b7327ffb30816273a74b142cccc0bc10c5a4c67/pkg/download/extension_runtime_webview.go#L163-L199","documentation":"Argument-presence error from requireStringArg raised by the type binding's second argument (extension_runtime_webview.go:179-182): page.type(selector, text) was called with a selector but without usable text. requireStringArg at index 1 rejects nil, undefined and null, aborting the script before page.Type executes.","triggerScenarios":"Calling page.type(\"#password\") with the text omitted; passing an undefined credentials field (creds.password when the object lacks it); passing null explicitly to mean \"type nothing\".","commonSituations":"Credential storage lookups returning undefined for missing keys; optional form fields where the value is genuinely absent; spreads like page.type(sel, ...args) with an empty args tail.","solutions":["Supply the text: page.type(\"#password\", credentials.password)","Skip the call entirely when the value is absent rather than passing undefined","Validate the credentials object has all required keys before starting the form flow"],"exampleFix":"// before\npage.type(\"#password\", creds.password); // creds.password undefined\n\n// after\nif (typeof creds.password !== \"string\" || !creds.password) {\n  throw new Error(\"password missing from credentials\");\n}\npage.type(\"#password\", creds.password);","handlingStrategy":"validation","validationCode":"if (typeof text !== \"string\" || text.length === 0) {\n  throw new TypeError(\"type text is required\");\n}\npage.type(selector, text);","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === \"string\" && v.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Check credential objects for required keys before typing them","Skip optional fields when the value is absent rather than passing undefined","Avoid spread calls that can drop trailing arguments"],"tags":["extension","webview","type","validation"],"backgroundTag":null,"analyzedSha":"7b7327ffb30816273a74b142cccc0bc10c5a4c67","analyzedAt":"2026-08-16T02:51:03.250Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}