Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to load colors from Figma #243

Open
kiddden opened this issue Oct 17, 2024 · 16 comments
Open

Error: Failed to load colors from Figma #243

kiddden opened this issue Oct 17, 2024 · 16 comments

Comments

@kiddden
Copy link

kiddden commented Oct 17, 2024

Tool version: 0.38.0

This week, I encountered a very strange bug. Everything was exporting fine except for the colors, and the terminal simply output the following error:

Error: Failed to load colors from Figma

The design team thoroughly checked everything, but there were no results.

I decided to experiment with figma-export.yaml and added nameValidateRegexp specifically for colors. Before, it was commented. Here's what I got in the terminal:

Error: ❌ Bad asset name «some_color_1»
❌ Bad asset name «some_color_2»
❌ Bad asset name «some_color_3»

I just fixed the regex to accept names that we use in Figma, and the problem was resolved.

I don't understand how it could be that with zero restrictions, it fails to export, but when I add restrictions, it works. Perhaps the library applies some default regex validation under the hood when we don't specify anything, but I couldn't find any information about this.
Another question is why it doesn't display any error message, when regex validation is commented.

I want to note that export works perfectly fine on other projects with the same config, and it also worked okay before on this project too. I'm not sure if this is a bug or not, and looking for a piece of advice.

UPD: There is no issue on 0.37.6, looks like the error is related to 0.38.0

@subdan
Copy link
Collaborator

subdan commented Oct 28, 2024

The error «Failed to load colors from Figma» occurs when the library gets a network error or a Figma API error. It is strange that adding nameValidateRegexp parameters fixes the issue. Could you please give me access to your Figma file so I can reproduce the issue?

Perhaps the library applies some default regex validation under the hood when we don't specify anything, but I couldn't find any information about this.

No, the library doesn't apply default regexp validation.

Another question is why it doesn't display any error message, when regex validation is commented.

Because the library unable to get colors from Figma API. I agree with you that it is not clear from the error message what the cause of the error is. It should print Figma API error message at least.

@kiddden
Copy link
Author

kiddden commented Nov 4, 2024

Unfortunately can't share the figma file. I did my best to replicate the issue on my own projects, but unfortunately, no success. It seems like this issue is quite rare. At my workplace, we follow the same design rules across many projects, but for some reason, this specific one is giving us trouble.
Anyway, I believe more detailed error messages could help.

@robertmusialek
Copy link

Hey @subdan

I just run into similar issue of Error: Failed to load colors from Figma after bumping tool version to 0.38.0. On any earlier version exporting our figma project works fine, but on the 0.38.0 it throws an error as above.

@subdan
Copy link
Collaborator

subdan commented Nov 6, 2024

@robertmusialek could you please share your Figma file so I can reproduce the issue?

@robertmusialek
Copy link

Unfortunately that is something I cannot share outside of our company :(

@subdan
Copy link
Collaborator

subdan commented Dec 2, 2024

@kiddden, @robertmusialek Which Figma plan do you have?

@kiddden
Copy link
Author

kiddden commented Dec 3, 2024

Premium version

@subdan
Copy link
Collaborator

subdan commented Dec 3, 2024

There is no Premium plan. To export variables you must have Enterprise plan.

https://www.figma.com/pricing/

@kiddden
Copy link
Author

kiddden commented Dec 3, 2024

I'm sorry, we use Professional Team plan

@subdan
Copy link
Collaborator

subdan commented Dec 3, 2024

Sync variables to code via REST API only available for Enterprise plan

@subdan
Copy link
Collaborator

subdan commented Dec 3, 2024

Do you use Variables or Color Styles for colors?

@kiddden
Copy link
Author

kiddden commented Dec 3, 2024

We use color styles

@subdan
Copy link
Collaborator

subdan commented Dec 3, 2024

Did you try to use 0.37.6?

@kiddden
Copy link
Author

kiddden commented Dec 3, 2024

Yes, this version works nicely. Forgot to mention it in the issue. Will update it now.

@subdan
Copy link
Collaborator

subdan commented Dec 3, 2024

@kiddden did you set variablesColors in you figma-export.yaml file?

@kiddden
Copy link
Author

kiddden commented Dec 4, 2024

No, we haven't touched color variables at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants