AlistGo/alist · error · errInvalidParameter

invalid parameter

Error message

invalid parameter

What it means

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.

Source

Thrown at pkg/aria2/rpc/client.go:27

	"time"
)

// Option is a container for specifying Call parameters and returning results
type Option map[string]interface{}

type Client interface {
	Protocol
	Close() error
}

type client struct {
	caller
	url   *url.URL
	token string
}

var (
	errInvalidParameter = errors.New("invalid parameter")
	errNotImplemented   = errors.New("not implemented")
	errConnTimeout      = errors.New("connect to aria2 daemon timeout")
)

// New returns an instance of Client
func New(ctx context.Context, uri string, token string, timeout time.Duration, notifier Notifier) (Client, error) {
	u, err := url.Parse(uri)
	if err != nil {
		return nil, err
	}
	var caller caller
	switch u.Scheme {
	case "http", "https":
		caller = newHTTPCaller(ctx, u, timeout, notifier)
	case "ws", "wss":
		caller, err = newWebsocketCaller(ctx, u.String(), timeout, notifier)
		if err != nil {
			return nil, err

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Fix the RPC URI to a full http://, https://, ws:// or wss:// URL (usually http://host:6800/jsonrpc)
  2. Skip the Multicall call when the methods list is empty instead of invoking it
  3. Validate the URI scheme before constructing the client in config-loading code

Example fix

// before
c, err := rpc.New(ctx, "localhost:6800/jsonrpc", token, timeout, nil)
// after
c, err := rpc.New(ctx, "http://localhost:6800/jsonrpc", token, timeout, nil)
Defensive patterns

Strategy: validation

Validate before calling

// Before constructing the client
u, err := url.Parse(rpcURI)
if err != nil { return err }
switch u.Scheme {
case "http", "https", "ws", "wss":
default:
    return fmt.Errorf("unsupported rpc scheme %q", u.Scheme)
}
// And before multicall:
if len(methods) == 0 { return nil }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/f52adb8150b39af5. Report an issue: GitHub.