AlistGo/alist · error

yunpan upload request failed: errno=%d

Error message

yunpan upload request failed: errno=%d

What it means

Thrown in decodeUploadResp when the JSON envelope parsed fine but env.Errno is a non-nil pointer to a non-zero value AND env.Errmsg is empty — i.e. the 360 yunpan upload API reported a business failure code without a human-readable message. The driver falls back to printing the bare errno.

Source

Thrown at drivers/yunpan360/upload.go:637

	respBody, err := io.ReadAll(resp.Body)
	if err != nil {
		return err
	}
	if resp.StatusCode >= http.StatusBadRequest {
		return fmt.Errorf("yunpan upload request failed: status=%d body=%s", resp.StatusCode, strings.TrimSpace(string(respBody)))
	}
	return decodeUploadResp(respBody, out)
}

func decodeUploadResp(body []byte, out interface{}) error {
	var env uploadEnvelope
	if err := utils.Json.Unmarshal(body, &env); err != nil {
		return err
	}
	if env.Errno != nil && *env.Errno != 0 {
		if env.Errmsg == "" {
			return fmt.Errorf("yunpan upload request failed: errno=%d", *env.Errno)
		}
		return errors.New(env.Errmsg)
	}
	if env.Errno == nil && strings.TrimSpace(env.Errmsg) != "" && len(env.Data) > 0 && string(env.Data) == "[]" {
		return errors.New(env.Errmsg)
	}
	if out == nil {
		return nil
	}
	if err := utils.Json.Unmarshal(body, out); err != nil {
		if strings.TrimSpace(env.Errmsg) != "" {
			return errors.New(env.Errmsg)
		}
		return err
	}
	return nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Refresh the Cookie credential and retry — session errno is the most common silent code
  2. Look up the numeric errno against 360 yunpan error tables (or capture a web-UI upload via devtools to see its meaning)
  3. Verify account quota and file type restrictions in the web UI
  4. Retry after a delay if the errno corresponds to throttling
Defensive patterns

Strategy: try-catch

Validate before calling

if strings.TrimSpace(d.Cookie) == "" {
    return errors.New("yunpan360: cookie missing; upload will fail with bare errno")
}

Try / catch

if err := decodeUploadResp(respBody, out); err != nil {
    if strings.Contains(err.Error(), "errno=") {
        code := parseErrno(err) // map known codes: session, quota, throttle
        switch {
        case code == errnoSessionExpired:
            return fmt.Errorf("yunpan360 cookie expired, update credential: %w", err)
        case isThrottle(code):
            time.Sleep(10 * time.Second)
            return retryUpload()
        }
    }
    return err
}

Prevention

When it happens

Trigger: Upload API returning errno like session-expired, quota-exceeded, or file-rejected with Errmsg stripped; cookie auth invalid; file type blocked; anti-abuse throttle codes that omit messages.

Common situations: Expired cookie session where the upload endpoint signals only by errno; hitting upload frequency limits; uploading files the pan classifies as unsafe; API version changes introducing new unmapped errno values.

Related errors


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