Hive Hive
Sign in

Strings assets conflicts and compiler errors.

GitHub issue · Open

Metadata
Source
tuist/tuist #7684
Updated
Jun 11, 2026
Domains
Generated projects
Details

What happened?

Some keys that are similar can conflict with each other.

How do we reproduce it?

Have the following keys in Localizable.strings file:

  1. “Book now”
  2. “Book Now”
  3. “Confirmed!”
  4. “CONFIRMED”
  5. “TIckets”
  6. “TICKETS”
  7. “Event.booking.ticketsBooked.title”
  8. “event.share”
  9. “SignIn.forgotPasswordButton”
  10. “sign-in.error.invalid-email”
  11. “yes "geez”
  12. Observe the conflict errors.

Error log

Invalid redeclaration of <var_name>
Unterminated string literal.

macOS version

15.4

Tuist version

4.44.3

Xcode version

16.3

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
P
pepicrft Jun 15, 2025

Hi @louwe 👋🏼 Could you include a reproducible project?

P
pepicrft Jun 18, 2025

Thanks @pepicrft. We won’t be able to prioritize looking into it, but you or anyone is more than welcome to debug the issue following our contributors’ guidelines. If you run the same command from Xcode, you’ll be able to see where the error is coming from and come up with an idea for how to fix it.

L
louwe Jun 20, 2025

Ah thanks. I will try hopefully soon when I get the time to set up the environment.

E
EmirhanKarahan Sep 16, 2025

Hi, I was looking for my first issue to work on and picked this one. First, I should mention that in these examples, multiple invalid key definitions are being used.

After some research, I found out that this behavior is actually expected. When I created a project with SwiftGen without Tuist and tested the same cases, I observed the same results. Since a variable name can only contain alphanumeric characters, SwiftGen strips others out. It also lowercases the first word when generating enum cases.

It seems possible to adjust this behavior by customizing the SynthesizedResourceInterfaceTemplates.stringsTemplate, though I’m not entirely sure if this would fully work or if it’s really necessary. Waiting your response to continue to work on it @pepicrft @louwe

L
louwe Sep 16, 2025

In my opinion, there are two ways to fix this:

  1. Use a less rigid naming variable naming scheme so as to not generate duplicates.
  2. If it encounters a case it cannot handle, simply omit/comment it in the final generated file so as to not create a compiler error and maybe generate warning messages in the console.
P
pepicrft Sep 18, 2025

Thanks @EmirhanKarahan for going deep into this one. If this is a SwiftGen behaviour, this is something that should be solved at that layer. If I’m not mistaken (It’s been a while without touching that area), you should be able to override the templates, which I’d suggest to use to workaround a limitation of SwiftGen.