AlistGo/alist · error

copy failed: %s

Error message

copy failed: %s

What it means

GuangYaPan Copy error: /file/copy_file returned non-success msg, surfaced as 'copy failed: <backend msg>'. Like Move, a successful copy returns a taskID which the driver polls; this error means the copy request itself was refused.

Source

Thrown at drivers/guangyapan/driver.go:368

	if err := d.ensureAccessToken(ctx); err != nil {
		return err
	}

	fileID := strings.TrimSpace(srcObj.GetID())
	if fileID == "" {
		return errors.New("file id is empty")
	}
	parentID := dstDir.GetID()

	var out deleteResp
	if err := d.postAPI(ctx, "/nd.bizuserres.s/v1/file/copy_file", map[string]any{
		"fileIds":  []string{fileID},
		"parentId": parentID,
	}, &out); err != nil {
		return err
	}
	if !strings.EqualFold(strings.TrimSpace(out.Msg), "success") {
		return fmt.Errorf("copy failed: %s", strings.TrimSpace(out.Msg))
	}
	taskID := strings.TrimSpace(out.Data.TaskID)
	if taskID == "" {
		return nil
	}
	return d.waitTaskDone(ctx, taskID)
}

func (d *GuangYaPan) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, up driver.UpdateProgress) error {
	if err := d.ensureAccessToken(ctx); err != nil {
		return err
	}
	if file == nil {
		return errors.New("file is nil")
	}
	if file.GetSize() < 0 {
		return errors.New("invalid file size")
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Read the backend msg — quota vs permission vs not-found have different fixes
  2. Free space or choose a different destination if quota is the cause
  3. Refresh destination listing and confirm write permission before copying
  4. Retry once other server-side tasks on the source file complete
Defensive patterns

Strategy: try-catch

Try / catch

err := d.Copy(ctx, srcObj, dstDir)
if err != nil && strings.HasPrefix(err.Error(), "copy failed") {
  if strings.Contains(err.Error(), "space") || strings.Contains(err.Error(), "空间") {
    // quota: stop and notify user instead of retrying
  }
}

Prevention

When it happens

Trigger: Calling Copy where the backend rejects it: insufficient storage quota for the duplicate, destination invalid or read-only, file locked by a concurrent task, or too many files in the copy batch — msg != success.

Common situations: Account storage full so the duplicate cannot be created; copying into a deleted/stale destination folder; concurrent copy/move of the same source file; share-based destination without write permission.

Related errors


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