{"record":{"id":"f52adb8150b39af5","repo":"AlistGo/alist","slug":"invalid-parameter","errorCode":null,"errorMessage":"invalid parameter","messagePattern":"invalid parameter","errorType":"exception","errorClass":"errInvalidParameter","httpStatus":null,"severity":"error","filePath":"pkg/aria2/rpc/client.go","lineNumber":27,"sourceCode":"\t\"time\"\n)\n\n// Option is a container for specifying Call parameters and returning results\ntype Option map[string]interface{}\n\ntype Client interface {\n\tProtocol\n\tClose() error\n}\n\ntype client struct {\n\tcaller\n\turl   *url.URL\n\ttoken string\n}\n\nvar (\n\terrInvalidParameter = errors.New(\"invalid parameter\")\n\terrNotImplemented   = errors.New(\"not implemented\")\n\terrConnTimeout      = errors.New(\"connect to aria2 daemon timeout\")\n)\n\n// New returns an instance of Client\nfunc New(ctx context.Context, uri string, token string, timeout time.Duration, notifier Notifier) (Client, error) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar caller caller\n\tswitch u.Scheme {\n\tcase \"http\", \"https\":\n\t\tcaller = newHTTPCaller(ctx, u, timeout, notifier)\n\tcase \"ws\", \"wss\":\n\t\tcaller, err = newWebsocketCaller(ctx, u.String(), timeout, notifier)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/pkg/aria2/rpc/client.go#L9-L45","documentation":"Sentinel error errInvalidParameter in the aria2 RPC client, used in two places: rpc.New rejects URI schemes other than http/https/ws/wss, and Multicall rejects an empty methods slice before issuing the call. It is a client-side argument check, so no request reaches the aria2 daemon when it is returned.","triggerScenarios":"Calling rpc.New with a URI like 'ftp://host' or a typo'd scheme; or calling client.Multicall with a zero-length []Method. In older forks it may also be returned for malformed params on specific calls.","commonSituations":"Configured aria2 RPC URL missing its scheme or using a wrong one (e.g. 'localhost:6800/jsonrpc' without http://); building a multicall from a filtered list that ended up empty.","solutions":["Fix the RPC URI to a full http://, https://, ws:// or wss:// URL (usually http://host:6800/jsonrpc)","Skip the Multicall call when the methods list is empty instead of invoking it","Validate the URI scheme before constructing the client in config-loading code"],"exampleFix":"// before\nc, err := rpc.New(ctx, \"localhost:6800/jsonrpc\", token, timeout, nil)\n// after\nc, err := rpc.New(ctx, \"http://localhost:6800/jsonrpc\", token, timeout, nil)","handlingStrategy":"validation","validationCode":"// Before constructing the client\nu, err := url.Parse(rpcURI)\nif err != nil { return err }\nswitch u.Scheme {\ncase \"http\", \"https\", \"ws\", \"wss\":\ndefault:\n    return fmt.Errorf(\"unsupported rpc scheme %q\", u.Scheme)\n}\n// And before multicall:\nif len(methods) == 0 { return nil }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure the full aria2 RPC URL including scheme (http://host:6800/jsonrpc)","Guard Multicall call sites against empty method lists","Validate config at load time, not at first RPC use"],"tags":["aria2","rpc","validation","config"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}