Unable to Access Modes of External Libraries in Figma Plugin API

Hello, Figma community!

I am working on a Figma plugin that needs to access the modes of both local and external library variable collections. However, I have encountered an issue where I am unable to access the modes of external libraries through the Figma Plugin API.

Here is the code I am using:

figma.on("selectionchange", async () => {
  console.log("Selection changed!");
  const selectedNodes = figma.currentPage.selection;
  if (selectedNodes.length > 0) {
    // Accessing modes for local variable collections
    const localVariableCollections = figma.variables.getLocalVariableCollections();
    localVariableCollections.forEach((collection) => {
      console.log("Local collection name:", collection.name);
      if (collection.modes) {
        collection.modes.forEach((mode) => {
          console.log("Mode:", mode.name);

    // Accessing modes for external libraries
    const libraryCollections =
      await figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync();
    libraryCollections.forEach((collection) => {
      console.log("Library collection name:", collection.name);
      if (collection.modes) {
        collection.modes.forEach((mode) => {
          console.log("Mode:", mode.name);

Here are the logs from running the code:

Selection changed!
Local collection name: semantic colors
Mode: light
Mode: dark
Library collection name: Collection 1
Library collection name: Collection 2

As you can see, I am able to retrieve the modes for the local collection “semantic colors” (light and dark), but not for the external libraries “Collection 1” and “Collection 2”.

Is this a limitation of the Figma Plugin API, or am I missing something? If anyone has a solution or workaround to access the modes of external library variable collections, I would greatly appreciate it.

Thank you for your help!

Did you add team library permission to the manifest and enable the required libraries in the Figma UI in the current file?

Hello Gleb !

Thanks for your time! Yes, I’ve integrated the team library permission in the manifest and the libraries are enabled in the current file.

Hey Rob, did you manage to find a solution that doesn’t involve the Figma rest api?
Its not clear to me why the mode names would not be included…

Hey Michel !

I tried but did not succeed so I finally didn’t used external modes in my project :sweat_smile: