AlistGo/alist · error

errno: %d, refer to https://photo.baidu.com/union/doc

Error message

errno: %d, refer to https://photo.baidu.com/union/doc

What it means

Catch-all in BaiduPhoto.Request (drivers/baidu_photo/utils.go:56): any union API errno not explicitly mapped (50805/50820/50100) is wrapped as 'errno: %d, refer to https://photo.baidu.com/union/doc'. It preserves the numeric code so the developer can look up the exact cause in Baidu's official union doc. Common unmapped codes include -6 (identity/token expired, whose refresh branch is commented out in the source) and various rate-limit codes.

Source

Thrown at drivers/baidu_photo/utils.go:56

		return nil, err
	}

	erron := utils.Json.Get(res.Body(), "errno").ToInt()
	switch erron {
	case 0:
		break
	case 50805:
		return nil, fmt.Errorf("you have joined album")
	case 50820:
		return nil, fmt.Errorf("no shared albums found")
	case 50100:
		return nil, fmt.Errorf("illegal title, only supports 50 characters")
	// case -6:
	// 	if err = d.refreshToken(); err != nil {
	// 		return nil, err
	// 	}
	default:
		return nil, fmt.Errorf("errno: %d, refer to https://photo.baidu.com/union/doc", erron)
	}
	return res, nil
}

//func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
//	res, err := d.request(furl, method, callback, resp)
//	if err != nil {
//		return nil, err
//	}
//	return res.Body(), nil
//}

// func (d *BaiduPhoto) refreshToken() error {
// 	u := "https://openapi.baidu.com/oauth/2.0/token"
// 	var resp base.TokenResp
// 	var e TokenErrResp
// 	_, err := base.RestyClient.R().SetResult(&resp).SetError(&e).SetQueryParams(map[string]string{
// 		"grant_type":    "refresh_token",

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Look up the numeric errno at https://photo.baidu.com/union/doc to get the authoritative cause
  2. For errno -6, refresh the access_token (re-init the driver / update credentials) and retry
  3. Add rate-limit backoff if the code appears under concurrency
  4. Add an explicit case in the switch for recurring codes so they get actionable messages

Example fix

// before
default:
    return nil, fmt.Errorf("errno: %d, refer to https://photo.baidu.com/union/doc", erron)

// after (map the recurring code explicitly, and revive token refresh)
case -6:
    if err := d.refreshToken(); err != nil {
        return nil, err
    }
    return d.Request(client, furl, method, callback, resp) // one retry
default:
    return nil, fmt.Errorf("errno: %d, refer to https://photo.baidu.com/union/doc", erron)
Defensive patterns

Strategy: retry

Try / catch

res, err := d.Request(client, furl, method, callback, resp)
if err != nil {
    var errno int
    if _, e := fmt.Sscanf(err.Error(), "errno: %d", &errno); e == nil {
        switch errno {
        case -6: // token expired -> refresh once, then retry once
            if rerr := d.refreshToken(); rerr != nil {
                return nil, rerr
            }
            return d.Request(client, furl, method, callback, resp)
        }
    }
}
return res, err

Prevention

When it happens

Trigger: Any BaiduPhoto Request/Get/Post whose JSON body carries a non-zero errno outside the three mapped cases: expired access_token (errno -6), rate limiting, invalid parameters, backend quota errors.

Common situations: Long-running mounts whose token expired; concurrent requests triggering rate limits; API changes on Baidu's side introducing new errno values.

Related errors


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