"An internal error occurred. Editing functionality may be limited." means Xcode's source editor services, such as indexing, code completion and live issues, stopped working for the open project; builds usually still work. Quit Xcode, delete that project's folder in DerivedData, and open the project again so Xcode rebuilds its index. The script below lists DerivedData folders with the project each belongs to and deletes only the one you name. Reinstalling Xcode or updating macOS should come last, not second.
SWIFT TIPS · XCODE · TROUBLESHOOTING
First posted on June 5, 2018, as "Try to Fix: an internal error has occurred. editing functionality may be limited". Rewritten on November 19, 2026. The script was run on a Mac with macOS 26.0.1 against a sample DerivedData folder made for the test. On this Mac's real DerivedData, a read-only check only counted folders and confirmed the key the script reads; no project paths were printed and nothing was deleted.
In 2018 Xcode showed a yellow bar across the editor: "An internal error occurred. Editing functionality may be limited." The post's fix was to clean DerivedData through Xcode's preferences, Locations, then the arrow next to the DerivedData path, and delete everything there. If that didn't help, restart the Mac, or delete Xcode, update macOS to High Sierra and install Xcode 9.3 from the App Store.
Deleting DerivedData is still the fix that works most often. But you don't have to delete every project's data to fix one, and the drastic steps come with a cost. This rewrite explains what the bar means, gives a script that deletes only what you choose, and puts the steps in order.
What the yellow bar means
The bar appears when the services behind the editor fail: syntax coloring that understands your code, code completion, jump to definition, live errors as you type. They depend on Xcode's index and build information for the project, which live in DerivedData. When that data is out of date or damaged, for example after switching branches with big changes, after an Xcode update, or after a crash during indexing, the services can fail. That's why the editor is "limited" while building often still works: the compiler doesn't need the index.
The bar has a Report a Bug link. If the problem comes back after a clean, that's worth using, because the report includes logs Apple can use.
Delete one project's DerivedData, not all of it
DerivedData has one folder per project, named after the project with a long suffix, so two projects called MyApp get two folders. Deleting everything forces every project on the Mac to reindex and rebuild from scratch. This script shows which folder belongs to which project, and deletes only the matching ones, and only when Xcode is closed:
#!/bin/bash
# derived_data.sh: lists Xcode's DerivedData folders with the project each belongs to,
# and deletes one project's folder (or all of them) only when Xcode is closed.
# Usage: ./derived_data.sh list
# ./derived_data.sh MyApp delete the folders of projects whose path contains "MyApp"
# ./derived_data.sh --all delete everything in DerivedData
DD="${DERIVED_DATA:-$HOME/Library/Developer/Xcode/DerivedData}"
[ -d "$DD" ] || { echo "No DerivedData folder at $DD"; exit 0; }
project_of() { /usr/libexec/PlistBuddy -c "Print :WorkspacePath" "$1/info.plist" 2>/dev/null || echo "?"; }
if [ -z "$1" ]; then
for d in "$DD"/*/; do
[ -d "$d" ] || continue
printf "%8s %s <- %s\n" "$(du -sh "$d" | cut -f1)" "$(basename "$d")" "$(project_of "$d")"
done
exit 0
fi
if pgrep -xq Xcode; then echo "Quit Xcode first."; exit 1; fi
for d in "$DD"/*/; do
[ -d "$d" ] || continue
if [ "$1" = "--all" ] || [[ "$(project_of "$d")" == *"$1"* ]]; then
echo "Deleting $(basename "$d")"
rm -rf -- "${d%/}"
fi
done
I made a sample DerivedData folder with three projects, two of them called MyApp in different places, and ran the script with DERIVED_DATA pointing at it:
$ ./derived_data.sh
300K MyApp-abcdefghijklmnop <- /Users/dev/Projects/MyApp/MyApp.xcodeproj
300K MyApp-zyxwvutsrqponmlk <- /Users/dev/Old/MyApp/MyApp.xcodeproj
300K Shop-qrstuvwxyzabcdef <- /Users/dev/Projects/Shop/Shop.xcworkspace
$ ./derived_data.sh Shop
Deleting Shop-qrstuvwxyzabcdef
$ ./derived_data.sh
300K MyApp-abcdefghijklmnop <- /Users/dev/Projects/MyApp/MyApp.xcodeproj
300K MyApp-zyxwvutsrqponmlk <- /Users/dev/Old/MyApp/MyApp.xcodeproj
- Listing comes first. Running it with no argument shows each folder's size and the project file it belongs to, so you can see what a delete would remove.
- The project path comes from Xcode's own file. Project folders have an
info.plistwith aWorkspacePathkey; on this Mac, every DerivedData folder that had aninfo.plist(three of them) had that key, which is what the script relies on. A folder without one lists as?. - Matching is by path.
./derived_data.sh Shopremoved only the Shop folder. Use a part of the path that's unique;MyApphere would match both MyApp folders. - It refuses while Xcode runs. Deleting the index under a running Xcode just gives it something else to fail on.
If you changed the DerivedData location in Xcode's settings, set DERIVED_DATA to that folder when you run the script.
The order to try things
- Close and reopen the project. Sometimes the services restart and the bar goes away.
- Quit Xcode, delete the project's DerivedData folder, open the project again, and wait for indexing to finish before judging. The progress shows at the top of the Xcode window.
- Check the package and pod setup. If the project uses Swift packages, File, Packages, Reset Package Caches; if it uses CocoaPods, open the
.xcworkspace, not the.xcodeproj. - Restart the Mac. It clears stuck background processes, including the ones that index.
- Update or reinstall Xcode only after that. Reinstalling takes long and downloads many gigabytes; updating macOS just for this is rarely needed.
A quick check for your project
- Run the script without arguments and look at the total size. Old folders for projects you no longer open are safe to delete.
- If the bar comes back on one project only, compare that project's setup with a working one: workspace vs project, package caches, generated files.
- If it keeps coming back after every clean, use Report a Bug from the bar.
What the 2018 version said
The post showed the bar as it appears at the top of the editor:
![]()
Its DerivedData path, /Users/mac/Library/Developer/Xcode/DerivedData, used "mac" as the user name; yours has your own user name in it, which is why the script builds the path from $HOME.
If this helped, you can buy me a coffee.
Keep reading on JR Devhub
Comments