AlistGo/alist · error

client not initialized

Error message

client not initialized

What it means

Chunked upload was attempted before the HTTP client was initialized (d.client is nil), i.e. the driver was not logged in or Init failed, so no requests can be issued.

Solutions

  1. Check the storage configuration and the provider's service status, fix the indicated cause, and retry the operation.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at drivers/bitqiu/driver.go:479 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/4e90f55b9b850f1a. Report an issue: GitHub.

Appendix: source

Thrown at drivers/bitqiu/driver.go:479

			return nil, fmt.Errorf("upload failed: %s", resp.Message)
		}
	}

	var resource Resource
	if err := json.Unmarshal(resp.Data, &resource); err != nil {
		return nil, fmt.Errorf("parse upload response failed: %w", err)
	}
	obj, err := resource.toObject(parentID, parentPath)
	if err != nil {
		return nil, err
	}
	up(100)
	return obj, nil
}

func (d *BitQiu) uploadFileInChunks(ctx context.Context, tmpFile model.File, size int64, md5sum string, initData UploadInitData, up driver.UpdateProgress) (string, error) {
	if d.client == nil {
		return "", fmt.Errorf("client not initialized")
	}
	if size <= 0 {
		return "", fmt.Errorf("invalid file size")
	}
	buf := make([]byte, chunkSize)
	offset := int64(0)
	var finishedFlag string

	for offset < size {
		chunkLen := chunkSize
		remaining := size - offset
		if remaining < chunkLen {
			chunkLen = remaining
		}

		reader := io.NewSectionReader(tmpFile, offset, chunkLen)
		chunkBuf := buf[:chunkLen]
		if _, err := io.ReadFull(reader, chunkBuf); err != nil {

View on GitHub (pinned to 843d9dc814)