GopeedLab/gopeed · error
missing or invalid "url"
Error message
missing or invalid "url"
What it means
Argument-presence error from requireStringArg raised inside the webview page goto binding (extension_runtime_webview.go:130-134): the navigation was attempted without a usable URL. gopeed.runtime.webview page objects expose goto(url, options?), and the first argument must be present (non-nil, non-undefined, non-null) or the bridge panics before page.Goto is reached.
Source
Thrown at pkg/download/extension_runtime_webview.go:133
return obj
}
func newJSWebViewPage(vm *goja.Runtime, page *enginewebview.PageHandle) *goja.Object {
obj := vm.NewObject()
_ = obj.Set("addInitScript", func(call goja.FunctionCall) goja.Value {
script, err := requireStringArg(call, 0, "script")
if err != nil {
panic(vm.ToValue(err))
}
if err := page.AddInitScript(script); err != nil {
panic(vm.ToValue(err))
}
return goja.Undefined()
})
_ = obj.Set("goto", func(call goja.FunctionCall) goja.Value {
url, err := requireStringArg(call, 0, "url")
if err != nil {
panic(vm.ToValue(err))
}
if err := page.Goto(
url,
optionalMap(call.Argument(1)),
); err != nil {
panic(vm.ToValue(err))
}
return goja.Undefined()
})
_ = obj.Set("execute", func(call goja.FunctionCall) goja.Value {
expression, err := enginewebview.NormalizeExecutableValue(call.Argument(0))
if err != nil {
panic(vm.ToValue(err))
}
result, err := page.Execute(expression, exportArgs(call.Arguments[1:])...)
if err != nil {
panic(vm.ToValue(err))
}View on GitHub (pinned to 7b7327ffb3)
Solutions
- Pass the URL string as the first argument: page.goto("https://example.com/file")
- Compute and validate the URL before navigating (throw your own descriptive error when absent)
- Default it when a fallback exists: page.goto(url ?? fallbackUrl)
Example fix
// before
const url = parsed.match(/href="([^"]+)"/)?.[1];
page.goto(url);
// after
const url = parsed.match(/href="([^"]+)"/)?.[1];
if (!url) throw new Error("could not extract download URL");
page.goto(url, { timeout: 30000 }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof url !== "string" || url.length === 0) {
throw new Error("goto target url is required");
}
page.goto(url); Type guard
function isUrlString(v) {
return typeof v === "string" && /^https?:\/\//.test(v);
} Prevention
- Extract URLs once, validate non-empty, then navigate
- Throw descriptive errors at extraction time instead of forwarding undefined
- Pass the options map as the second argument only
When it happens
Trigger: Calling page.goto() with no arguments; passing a URL variable that is undefined because a string operation returned nothing; template strings that evaluate to undefined; navigating to a value read from a map with a missing key.
Common situations: Resolvers that build the target URL from response parsing (undefined on unexpected HTML); passing res.url when the resource object lacks the field; refactoring that shifted the options map into the first position.
Related errors
- missing or invalid "%s"
- execute expects a string or function
- missing or invalid "selector"
- missing or invalid "text"
- NAVIGATION_FAILED
AI-assisted analysis of GopeedLab/gopeed@7b7327ffb3 (2026-08-16).
Data as JSON: /api/errors/be17622075395a9b.
Report an issue: GitHub.