diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index e8d520687..6d24f8fcc 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -182,7 +182,14 @@ def checkout_layers(layers, confdir, layerdir, d):
             else:
                 src_uri = f"{fetchuri};protocol={prot};rev={rev};nobranch=1;destsuffix={repodir}"
             fetcher = bb.fetch.Fetch([src_uri], d)
-            do_fetch(fetcher, layerdir)
+            repodir_path = os.path.join(layerdir, repodir)
+            try:
+                do_fetch(fetcher, layerdir)
+            except bb.fetch2.UnpackError as e:
+                raise Exception(
+                    "Cannot update source '{}' in {} because it has local modifications.\n"
+                    "Please commit, stash or discard your changes and re-run the update.\n"
+                    "Details: {}".format(r_name, repodir_path, e)) from None
             urldata = fetcher.ud[src_uri]
             revision = urldata.revision
             layers_fixed_revisions[r_name]['git-remote']['rev'] = revision
