AlistGo/alist · error

up.Msg

Error message

up.Msg

What it means

Cloudreve local upload chunk returned HTTP 200 but the JSON envelope in the body has a non-zero code; the server's message (up.Msg) is returned. This is the API-level failure of an otherwise HTTP-successful chunk PUT.

Source

Thrown at drivers/cloudreve/util.go:287

			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
			up(float64(finish) * 100 / float64(stream.GetSize()))
			chunk++
		} else {
			retryCount++
			if retryCount > maxRetries {
				return fmt.Errorf("upload failed after %d retries due to server errors, error: %s", maxRetries, err)
			}
			backoff := time.Duration(1<<retryCount) * time.Second
			utils.Log.Warnf("[Cloudreve-Remote] server errors while uploading, retrying after %v...", backoff)
			time.Sleep(backoff)
		}
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Restart the upload from scratch (new session) instead of resuming — session state on the server is likely stale.
  2. Raise the storage policy size limit in Cloudrebve if the failure starts at a consistent file size.
  3. Verify the driver's chunk size settings do not conflict with the server-side policy.
  4. Check Cloudrebve server logs for the exact code/message pair.
Defensive patterns

Strategy: retry

Try / catch

// inside the upLocal loop the driver already retries; catch at the caller and restart cleanly
if err := d.upLocal(ctx, stream, dirPath, overwrite, up); err != nil {
    if strings.Contains(err.Error(), "session") || strings.Contains(err.Error(), "credential") {
        return d.upLocal(ctx, stream, dirPath, overwrite, up) // fresh session, once
    }
    return err
}

Prevention

When it happens

Trigger: upLocal closure: json.Unmarshal(body, &up) succeeds, up.Code != 0. Typical when the upload session is invalid/finished, the credential does not cover this chunk index, or the server rejects the chunk size/hash.

Common situations: Uploading a file larger than policy limits so later chunks get rejected; resuming an upload whose session was completed or garbage-collected; concurrent uploads of the same file confusing session state.

Related errors


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