AlistGo/alist · error

missing file id

Error message

missing file id

What it means

Thrown by Wukong driver's Link() when a download link is requested for a file object whose ID is an empty string. The Wukong (wkbrowser) API identifies files solely by numeric file_id; without it the /open/file/link style request cannot be formed, so the driver refuses early instead of sending a guaranteed-to-fail request. It fires after the IsDir check, so it only occurs for file objects (not directories).

Source

Thrown at drivers/wukong/driver.go:144

				IsFolder: item.IsDirectory == 1,
			})
		}

		if !hasMore(resp.Data.HasMore) || len(resp.Data.FileList) == 0 {
			break
		}
		offset += len(resp.Data.FileList)
	}
	return objs, nil
}

func (d *Wukong) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
	if file.IsDir() {
		return nil, errs.NotFile
	}
	fileID := file.GetID()
	if fileID == "" {
		return nil, errors.New("missing file id")
	}

	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(fileID)},
		}).
		SetResult(&resp).
		Post("/netdisk/user_file/detail")
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-list the parent directory via List() and pass the returned object (which carries a real file ID) to Link()
  2. Verify file.GetID() != "" before invoking Link and surface a clearer upstream error if empty
  3. If objects come from your own cache, make sure the ID field round-trips through serialization

Example fix

// before
link, err := wukongDriver.Link(ctx, someFile, args)

// after
if someFile.GetID() == "" {
    fresh, err := wukongDriver.List(ctx, parentDir, model.ListArgs{})
    // resolve someFile by name in fresh, then Link the fresh object
}
link, err := wukongDriver.Link(ctx, freshFile, args)
Defensive patterns

Strategy: validation

Validate before calling

if file.IsDir() { return errs.NotFile }
if file.GetID() == "" {
    return nil, fmt.Errorf("wukong: object %q has no file id; refresh listing before Link", file.GetPath())
}

Prevention

When it happens

Trigger: Calling Link() on a model.Obj obtained from somewhere other than a fresh Wukong List() — e.g. an object reconstructed from a path by the framework, a cached/stale object whose ID was lost during serialization, or a manually constructed Obj with only Name/Path set.

Common situations: Using AList's path-to-object resolution on a mount where IDs are not persisted; object metadata caches that drop the ID field; calling driver APIs programmatically with hand-built objects; racing a Remove/Rename that invalidated the object.

Related errors


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