GopeedLab/gopeed · error
missing or invalid "text"
Error message
missing or invalid "text"
What it means
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.
Source
Thrown at pkg/download/extension_runtime_webview.go:181
})
_ = obj.Set("click", func(call goja.FunctionCall) goja.Value {
selector, err := requireStringArg(call, 0, "selector")
if err != nil {
panic(vm.ToValue(err))
}
if err := page.Click(selector, optionalMap(call.Argument(1))); err != nil {
panic(vm.ToValue(err))
}
return goja.Undefined()
})
_ = obj.Set("type", func(call goja.FunctionCall) goja.Value {
selector, err := requireStringArg(call, 0, "selector")
if err != nil {
panic(vm.ToValue(err))
}
text, err := requireStringArg(call, 1, "text")
if err != nil {
panic(vm.ToValue(err))
}
if err := page.Type(selector, text, optionalMap(call.Argument(2))); err != nil {
panic(vm.ToValue(err))
}
return goja.Undefined()
})
_ = obj.Set("waitForSelector", func(call goja.FunctionCall) goja.Value {
selector, err := requireStringArg(call, 0, "selector")
if err != nil {
panic(vm.ToValue(err))
}
result, err := page.WaitForSelector(
selector,
optionalMap(call.Argument(1)),
)
if err != nil {
panic(vm.ToValue(err))
}View on GitHub (pinned to 7b7327ffb3)
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
Example fix
// before
page.type("#password", creds.password); // creds.password undefined
// after
if (typeof creds.password !== "string" || !creds.password) {
throw new Error("password missing from credentials");
}
page.type("#password", creds.password); Defensive patterns
Strategy: validation
Validate before calling
if (typeof text !== "string" || text.length === 0) {
throw new TypeError("type text is required");
}
page.type(selector, text); Type guard
function isNonEmptyString(v) {
return typeof v === "string" && v.length > 0;
} Prevention
- 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
When it happens
Trigger: 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".
Common situations: 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.
Related errors
- missing or invalid "%s"
- missing or invalid "url"
- execute expects a string or function
- missing or invalid "selector"
- invalid resource file name
AI-assisted analysis of GopeedLab/gopeed@7b7327ffb3 (2026-08-16).
Data as JSON: /api/errors/1fd65dc4e03f712e.
Report an issue: GitHub.