AlistGo/alist · error

calculate md5 of %s failed: %w

Error message

calculate md5 of %s failed: %w

What it means

Error "calculate md5 of %s failed: %w" thrown in AlistGo/alist.

Source

Thrown at drivers/123_open/upload.go:48

func (d *Open123) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, up driver.UpdateProgress) (model.Obj, error) {
	if err := d.ensureToken(ctx); err != nil {
		return nil, err
	}
	if up == nil {
		up = func(float64) {}
	}
	parentFileID, err := parseFileID(dstDir.GetID())
	if err != nil {
		return nil, err
	}

	// the create call needs the whole file MD5; reuse the stream's own hash
	// when it has one, otherwise cache the stream and hash it on the way
	etag := file.GetHash().GetHash(utils.MD5)
	if len(etag) != utils.MD5.Width {
		_, etag, err = stream.CacheFullInTempFileAndHash(file, utils.MD5)
		if err != nil {
			return nil, fmt.Errorf("calculate md5 of %s failed: %w", file.GetName(), err)
		}
	}

	size := file.GetSize()
	created, err := d.client.Upload.Create(ctx, &pan123.UploadCreateRequest{
		ParentFileID: parentFileID,
		Filename:     file.GetName(),
		Etag:         etag,
		Size:         size,
	})
	if err != nil {
		return nil, fmt.Errorf("create upload of %s failed: %w", file.GetName(), err)
	}
	// instant upload: the server already holds this content
	if created.Reuse {
		up(100)
		return uploadedObj(created.FileID, file, etag), nil
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry.

When it happens

Trigger: Thrown at drivers/123_open/upload.go:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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