AlistGo/alist · error
[baidu_youth] %s (errno=%d)
Error message
[baidu_youth] %s (errno=%d)
What it means
Catch-all in BaiduYouth.doRequest (drivers/baidu_youth/util.go:113): the endpoint returned JSON with a non-zero errno, and the driver wraps the best available message as '[baidu_youth] %s (errno=%d)'. The message is extracted from the response body (extractBaiduMessage); errno -6 specifically maps to 'cookie expired or invalid' when no message is present.
Source
Thrown at drivers/baidu_youth/util.go:113
callback(req)
}
if resp != nil {
req.SetResult(resp)
}
res, err := req.Execute(method, d.normalizeURL(furl))
if err != nil {
return nil, err
}
body := res.Body()
if errno := utils.Json.Get(body, "errno").ToInt(); errno != 0 {
msg := extractBaiduMessage(body)
if errno == -6 && msg == "" {
msg = "cookie expired or invalid"
}
if msg == "" {
msg = "request failed"
}
return nil, fmt.Errorf("[baidu_youth] %s (errno=%d)", msg, errno)
}
return body, nil
}
func (d *BaiduYouth) get(ctx context.Context, pathname string, params map[string]string, resp interface{}) ([]byte, error) {
return d.doRequest(pathname, http.MethodGet, youthQueryParams(), func(req *resty.Request) {
req.SetContext(ctx)
if params != nil {
req.SetQueryParams(params)
}
}, resp)
}
func (d *BaiduYouth) postForm(ctx context.Context, pathname string, params map[string]string, form map[string]string, resp interface{}) ([]byte, error) {
return d.doRequest(pathname, http.MethodPost, youthQueryParams(), func(req *resty.Request) {
req.SetContext(ctx)
if params != nil {
req.SetQueryParams(params)View on GitHub (pinned to 843d9dc814)
Solutions
- For errno=-6, update the BDUSS/SToken cookies in the storage config and re-init
- Check the numeric errno against Baidu docs and the extracted message for the specific endpoint
- Verify server clock accuracy (NTP) since several calls sign with current time
- Retry once after re-init for transient errnos
Defensive patterns
Strategy: try-catch
Type guard
func isBaiduYouthErrno(err error) (int, bool) {
var target errnoError
if errors.As(err, &target) {
return target.code, true
}
// string fallback for the wrapped fmt.Errorf
var code int
if n, _ := fmt.Sscanf(err.Error(), "[baidu_youth] %*s (errno=%d)", &code); n == 1 {
return code, true
}
return 0, false
} Try / catch
body, err := d.get(ctx, path, params, &resp)
if err != nil {
if code, ok := isBaiduYouthErrno(err); ok && code == -6 {
// cookie expired: operator must refresh BDUSS/SToken in config
return fmt.Errorf("baidu_youth cookie expired: update storage credentials: %w", err)
}
return err
} Prevention
- Rotate Baidu cookies before they expire; -6 is the dominant failure mode
- Keep server time NTP-synced (time participates in request signing)
- Log the errno and extracted message together for fast triage
When it happens
Trigger: Any BaiduYouth get/post with failing errno: expired BDUSS/SToken cookie (-6), invalid signature on locatedownload (wrong sk or time), removed file, or rate limiting.
Common situations: Cookie pasted into config has expired (Baidu rotates sessions); server clock skew breaking time-based signatures; file deleted between list and link.
Related errors
- -10001
- errno: %d, refer to https://photo.baidu.com/union/doc
- failed to get bdstoken from baidu youth cookie
- failed to get uk from baidu youth cookie
- baidu youth sk is empty
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/c1ea1a8d8ec691cc.
Report an issue: GitHub.