AlistGo/alist · error

missing source file id

Error message

missing source file id

What it means

Thrown by Wukong's Move() when the source object's ID is empty. The move API posts a file_id for the object being relocated; an empty ID means the request payload would be meaningless, so the driver bails out before the HTTP call. Note the asymmetry: the destination may legitimately be empty (falls back to d.RootFolderID), but the source may not.

Source

Thrown at drivers/wukong/driver.go:216

		SetBody(map[string]any{
			"father_id": asIDValue(fatherID),
			"file_name": dirName,
		}).
		SetResult(&resp).
		Post("/netdisk/user_file/create_directory")
	if err != nil {
		return err
	}
	if resp.Code != 0 {
		return fmt.Errorf("wukong create directory failed: code=%d message=%s", resp.Code, resp.Message)
	}
	return nil
}

func (d *Wukong) Move(ctx context.Context, srcObj, dstDir model.Obj) error {
	srcID := srcObj.GetID()
	if srcID == "" {
		return errors.New("missing source file id")
	}

	dstID := dstDir.GetID()
	if dstID == "" {
		dstID = d.RootFolderID
	}

	var resp rawResp
	_, err := d.client.R().
		SetContext(ctx).
		SetQueryParams(map[string]string{
			"aid":             d.Aid,
			"device_platform": "web",
			"language":        d.Language,
		}).
		SetBody(map[string]any{
			"file_id_list":  []any{asIDValue(srcID)},
			"new_father_id": asIDValue(dstID),

View on GitHub (pinned to 843d9dc814)

Solutions

  1. List() the source's parent directory and pass the fresh object (with its ID) as srcObj
  2. Check srcObj.GetID() != "" before calling Move and fail fast with context about which path lacked an ID
  3. Ensure any object cache or job queue preserves the Wukong file ID field

Example fix

// before
err := d.Move(ctx, srcObj, dstDir)

// after
if srcObj.GetID() == "" {
    return fmt.Errorf("cannot move %q: wukong object has no file id; re-list parent to refresh", srcObj.GetPath())
}
err := d.Move(ctx, srcObj, dstDir)
Defensive patterns

Strategy: validation

Validate before calling

if srcObj.GetID() == "" {
    return fmt.Errorf("wukong: cannot move %q without file id; re-list source directory", srcObj.GetPath())
}

Prevention

When it happens

Trigger: Calling Move() with a srcObj that never came from Wukong List() — e.g. an object built from a raw path, a deserialized object that lost its ID, or an object from a different driver/mount passed by mistake.

Common situations: Cross-driver copy/move helpers that pass path-derived objects; object caches that drop IDs; moving an object that was concurrently deleted and re-created (stale reference).

Related errors


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