Bug 16203

Summary: bitbake-setup fails with key error when updating and using local repositories
Product: [Build System, Metadata & Runtime] BitBake Reporter: Jason Gauthier <jagauthier>
Component: bitbakeAssignee: Alexander Kanavin <alex.kanavin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: ccasciato, poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: 6.0 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jason Gauthier 2026-03-16 17:15:37 UTC
The scenario I've reproduced is follows:
I've created a json configuration.  Included in that json config are some standard yocto entries like so:
    "sources": {
        "bitbake": {
            "git-remote": {
                "remotes": {
                    "origin": {
                        "uri": "https://git.openembedded.org/bitbake"
                    }
                },
                "branch": "2.16",
                "rev": "2.16"
            }
        },
        "openembedded-core": {
            "git-remote": {
                "remotes": {
                    "origin": {
                        "uri": "https://git.openembedded.org/openembedded-core"
                    }
                },
                "branch": "whinlatter",
                "rev": "whinlatter"
            }
        },

Additionally, I have added a repository that is hosted on the local disk that I am using for development (adding images, recipes, etc)
        "meta-custom": {
            "git-remote": {
                "remotes": {
                    "origin": {
                        "uri": "https://github.com/name/meta-custom.git"
                    }
                },
                "branch": "whinlatter",
                "rev": "whinlatter"
            }
        }

Since bitbake strips the git information and manages the repo, I use "-L" to initialize everything, like so:
 
 ./bitbake/bin/bitbake-setup --setting default top-dir-prefix . --setting default top-dir-name build init --non-interactive mymachine.conf.json mymachine

I get output that the build environment is created. With the custom entry having a symlink created:

Making a symbolic link /home/jgauthier/yocto/whinlatter_build/build/mymachine/layers/meta-custom pointing to /home/jgauthier/yocto/whinlatter_build/sources/meta-custom

I then build and deploy my image and make sure everything works perfectly.  But I want to extend it now.

So, I attempt to add a new entry, for ROS, to my JSON, like so:
        "meta-ros2": {
            "git-remote": {
                "remotes": {
                    "origin": {
                        "uri": "https://github.com/ros/meta-ros.git"
                    }
                },
                "branch": "whinlatter",
                "rev": "whinlatter"
            }
        }

bitbake-setup status shows me:
diff --git a/config-upstream.json b/config-upstream.json
index a1fa4a6..e749505 100644
--- a/config-upstream.json
+++ b/config-upstream.json
@@ -98,6 +98,17 @@
                     "rev": "whinlatter"
                 }
             },
+            "meta-ros2": {
+                "git-remote": {
+                    "branch": "whinlatter",
+                    "remotes": {
+                        "origin": {
+                            "uri": "https://github.com/ros/meta-ros.git"
+                        }
+                    },
+                    "rev": "whinlatter"
+                }
+            },
             "meta-virtualization": {
                 "git-remote": {
                     "branch": "whinlatter",


Now, I when I run "bitbake-setup update" to apply the changes to the build environment I get this error:
Traceback (most recent call last):
  File "/home/jgauthier/yocto/whinlatter_build/build/mymachine/layers/bitbake/bin/bitbake-setup", line 1012, in <module>
    main()
  File "/home/jgauthier/yocto/whinlatter_build/build/mymachine/layers/bitbake/bin/bitbake-setup", line 1005, in main
    args.func(top_dir, all_settings, args, d)
  File "/home/jgauthier/yocto/whinlatter_build/build/mymachine/layers/bitbake/bin/bitbake-setup", line 638, in build_update
    build_status(top_dir, settings, args, d, update=True)
  File "/home/jgauthier/yocto/whinlatter_build/build/mymachine/layers/bitbake/bin/bitbake-setup", line 623, in build_status
    update_build(new_upstream_config, confdir, setupdir, layerdir, d,
  File "/home/jgauthier/yocto/whinlatter_build/build/mmymachine/layers/bitbake/bin/bitbake-setup", line 336, in update_build
    layer_config[k]["git-remote"] = v["git-remote"]
                                    ~^^^^^^^^^^^^^^
KeyError: 'git-remote'

From what I can see in bitbake-setup, a function called update_build():
    layer_config = copy.deepcopy(config["data"]["sources"])
    layer_overrides = config["source-overrides"]["sources"]
    for k,v in layer_overrides.items():
        if k in layer_config:
            layer_config[k]["git-remote"] = v["git-remote"] 

It's looking for a "git-remote" in the "source-overrides" section of "config-upstream.json" and it's simply not there because it is a "local repository"
I have not been able to work around this error.   I can build a new environment, and that works, but then I have to do a complete build which takes a fairly long time.
Comment 1 Alexander Kanavin 2026-03-19 17:05:13 UTC
Hello Jason,

I think this was fixed in bitbake master branch with 
https://git.openembedded.org/bitbake/commit/?id=adc18646459d9ff3110d2b5459a913d15d9cf8e6

Can you check if that helps?
Comment 2 Jason Gauthier 2026-03-19 18:05:43 UTC
I confirmed that the update_build() function in master resolves this.  I've updated my templates. Thanks!