AlistGo/alist · error

res.Status

Error message

res.Status

What it means

Surfaces during Cloudreve local-policy chunked upload: after PUTting a chunk with base.HttpClient.Do, the HTTP status is not 200 and res.Status (e.g. '403 Forbidden') is returned as the error. It reflects a transport/HTTP-level rejection of the chunk upload itself, before any JSON envelope is parsed.

Source

Thrown at drivers/cloudreve/util.go:275

		}
		req, err := http.NewRequest("POST", uploadUrl+"?chunk="+strconv.Itoa(chunk),
			driver.NewLimitedUploadStream(ctx, bytes.NewReader(byteData)))
		if err != nil {
			return err
		}
		req = req.WithContext(ctx)
		req.ContentLength = byteSize
		// req.Header.Set("Content-Length", strconv.Itoa(int(byteSize)))
		req.Header.Set("Authorization", fmt.Sprint(credential))
		req.Header.Set("User-Agent", d.getUA())
		err = func() error {
			res, err := base.HttpClient.Do(req)
			if err != nil {
				return err
			}
			defer res.Body.Close()
			if res.StatusCode != 200 {
				return errors.New(res.Status)
			}
			body, err := io.ReadAll(res.Body)
			if err != nil {
				return err
			}
			var up Resp
			err = json.Unmarshal(body, &up)
			if err != nil {
				return err
			}
			if up.Code != 0 {
				return errors.New(up.Msg)
			}
			return nil
		}()
		if err == nil {
			retryCount = 0
			finish += byteSize

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry the whole upload (re-create the upload session) — credentials are short-lived and a stale session URL is the most common cause.
  2. Check any WAF/CDN/nginx client_max_body_size in front of Cloudrebve allows your chunk size.
  3. Confirm the alist host clock is synced (signed credential URLs are time-sensitive).
  4. Inspect Cloudrebve logs for the matching request to see why the chunk endpoint rejected the request.
Defensive patterns

Strategy: retry

Try / catch

if err := upChunk(ctx, url, credential, data); err != nil {
    if strings.HasPrefix(err.Error(), "4") || strings.Contains(err.Error(), "Gone") {
        // credential/session likely expired: recreate the upload session once
        session, serr := d.createUploadSession(...)
        if serr == nil { return upChunk(ctx, session.URL, session.Credential, data) }
    }
    return err
}

Prevention

When it happens

Trigger: upLocal retry loop: request built with the upload credential URL, executed, res.StatusCode != 200. Produced by expired/one-time upload credentials, wrong Content-Length, blocked origin, or Cloudrebve returning 404/403 for the session upload URL.

Common situations: Upload session credential expired because the upload paused (chunk retries/backoff) past the credential TTL; Cloudrebve behind CDN/WAF that strips Authorization or limits body size; clock skew breaking signed URLs; server restarted mid-upload losing the session.

Related errors


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