How to fix "Build input file cannot be found" error in Xcode

⋅ 2 min read ⋅ Xcode

Table of Contents

Build input file cannot be found: '/path/to/some/of/your/file1', '/path/to/some/of/your/file2', ....

There might be several reasons that cause this error. I will share one solution that fixes the one that happened to me the most.

Cause of the problem

For me, I got this error when I try to solve merge conflict that happen on project.pbxproj. When there is changes in project structure I have to figure out conflict that look like this:

A000701D256E5ADF009F48A4 /* UsageDetailViewModelTests.swift in Sources */,
17E973942505E3EA0084D10D /* MainTabBarViewModelTests.swift in Sources */,
174BF411251C9C1E00FE6214 /* CommonNotificationIconViewTests.swift in Sources */,
=====
NOT_A000701D256E5ADF009F48A4 /* UsageDetailViewModelTests.swift in Sources */,
NOT_17E973942505E3EA0084D10D /* MainTabBarViewModelTests.swift in Sources */,
NOT_174BF411251C9C1E00FE6214 /* CommonNotificationIconViewTests.swift in Sources */,

There might be a better way to resolve this, but I always solve it quick and dirty by accepting one of them, or sometimes I take both of them. Manual manipulates of project structure like this can cause corrupted project structure, which is the cause of the error we will solve today.

"Build input file cannot be found" error

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Solution

  1. Open "Project Navigator" (Menu View > Navigators > Project ⌘ - command + 1).
  2. You will see a group name "Recovered References" that Xcode generated for you. If you have a large project, you can filter it out by type "Recovered References" at the very bottom of the project navigator.
Recovered References
Recovered References
If you have a large project, you can filter it out by type
If you have a large project, you can filter it out by type "Recovered References" at the very bottom of the project navigator.
  1. Inside the group, you should see a list of files mentioned in the "Build input file cannot be found" error.
  2. Next step might vary based on your situation. Normally, you will need to delete all red color files, which dictate that Xcode can't find their reference in the destination paths.
  3. You need to add them back so Xcode knows where it should look for those files.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Read more article about Xcode or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
How expensive is DateFormatter

If you are working on iOS for long enough, there is a chance that you might have known that DateFormatter is expensive, but what is costly about DateFormatter? Let's find out in this article.

Next
How to loop in Swift

Learn different ways of using for loop for each scenario.

← Home