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

Improve and clarify error for missing scheme file #2599

Merged

Conversation

friederbluemle
Copy link
Contributor

Summary

This improves and clarifies the error message printed by React Native CLI when the shared scheme file is missing.

Problem

I recently attempted to run an app with yarn ios, and received an error:

error Could not find scheme MyApp. Please make sure the schema you want to run exists. Available schemas are: MyApp'.

Subsequently I spent 1h+ digging through the code and local caches etc trying to figure out where that mysterious trailing apostrophe originated from (note, it mentions MyApp' is available, but it is looking for MyApp). It was nowhere to be found. As it turned out, the issue was with how RN CLI formatted the error.

Additionally, the existing error message makes it sound like the first reference to "MyApp" is directly related to or equivalent to the second reference. That's not the case. The first reference represents the shared scheme file it is trying to load, while the second reference is a list of schemes declared in the project configuration.

Lastly, the error message (as well as an internal variable in code) contains the term "schema", which should be "scheme". Minor difference, but to be consistent with the Apple/iOS ecosystem only "scheme" should be used.

Solution

  1. Remove misleading ' (apostrophe) from error message
  2. Slightly reword error message to clarify what schemes are declared in project config vs. expected files on file system
  3. Replace all usage of "schema" with the proper term "scheme"

Test Plan

First, I created a new test file for getBuildConfigurationFromXcScheme, ensuring 100% line coverage in the existing file. Then, in two additional commits, I made the changes, ensuring the tests will continue to run. When reviewing the PR commit-by-commit, it will be easiest to see.

Before

error Could not find scheme MyApp. Please make sure the schema you want to run exists. Available schemas are: MyApp'.

After

error Could not load the shared scheme for MyApp. Your project configuration includes: MyApp. Please ensure a valid .xcscheme file exists in xcshareddata/xcschemes.

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@thymikee thymikee merged commit 8c8c0ae into react-native-community:main Feb 18, 2025
8 checks passed
@friederbluemle friederbluemle deleted the improve-error-msg branch February 21, 2025 05:46
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

Successfully merging this pull request may close these issues.

3 participants