Duplicate package names not supported (colcon) and "already built in one or more underlay workspaces": copies, ignore files and --allow-overriding, measured
[0.328s] ERROR:colcon:colcon build: Duplicate package names not supported:
- pkg_a:
- src/pkg_a
- src/pkg_a_old
A related message is not an error at all:
WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'std_msgs' is in: /opt/ros/humble
...
If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding std_msgs
This may be promoted to an error in a future release of colcon-override-check.
Short answer: colcon found two folders whose package.xml has the same <name>. The error lists every path it found for that name. colcon exits with code 1 before it builds anything. The fix is to make one copy invisible to colcon. Delete it, move it out of the workspace, or drop an empty marker file in it:
touch src/pkg_a_old/COLCON_IGNORE
colcon build
COLCON_IGNORE, AMENT_IGNORE and CATKIN_IGNORE all worked on Humble, Jazzy and Lyrical. Lowercase colcon_ignore, .colcon_ignore and IGNORE did not. If you would rather leave the files alone for one build, colcon build --paths src/pkg_a src/pkg_b or --base-paths picks the folders explicitly.
The underlay warning is different. It only shows up when the colcon-override-check extension is installed. The build keeps going and exits 0. --allow-overriding std_msgs silences it. Without the extension, colcon rejects that flag as an unrecognized argument.

Find your case
Every row behaved the same on all three distros.
| What is in the workspace | Paths in the error | Fix that worked |
|---|---|---|
Copied package folder, e.g. src/pkg_a_old |
src/pkg_a, src/pkg_a_old |
COLCON_IGNORE in the copy, or delete it |
Same package inside a cloned repo, src/some_repo/pkg_a |
src/pkg_a, src/some_repo/pkg_a |
Remove one copy. A .git folder in the repo changed nothing. |
Repo cloned into the workspace root and also into src/ |
pkg_a, src/pkg_a |
colcon build --base-paths src, or remove the root copy |
colcon build run once inside src/, then COLCON_IGNORE files deleted |
src/install/pkg_a/share/pkg_a, src/pkg_a |
rm -rf src/build src/install src/log |
An old install/ copied into src/ without its COLCON_IGNORE |
src/old_install/pkg_a/share/pkg_a, src/pkg_a |
Move it out of src/ |
Copy renamed in package.xml only |
No duplicate error. CMake fails instead: package name 'pkg_a_old' in '/package.xml' does not match current PROJECT_NAME 'pkg_a' |
Rename project() in CMakeLists.txt too |
Overlay package with the same name as one in /opt/ros |
No error. Warning only if colcon-override-check is installed. |
--allow-overriding <pkg>, or rename your package |
What I ran
On 2026-10-30 I used the official ros:humble-ros-base, ros:jazzy-ros-base and ros:lyrical-ros-base Docker images, one after another, on a 2 vCPU runner. Each test made a fresh workspace /ws with two minimal ament_cmake packages, pkg_a and pkg_b. Each package had a package.xml and a four-line CMakeLists.txt (project(pkg_a NONE), find_package(ament_cmake REQUIRED), ament_package()). There was no C++ code. That keeps each build to a few seconds and isolates colcon's package discovery, which is where this error comes from.
For each case I recorded the full output, the exit code, and which packages ended up in install/. The underlay tests used std_msgs, which ships in all three images. I ran them twice: once with the image as shipped, and once after apt-get install python3-colcon-override-check. All three images had the same colcon packages: colcon-core 0.21.3, colcon-cmake 0.2.30, colcon-package-selection 0.2.10, colcon-recursive-crawl 0.2.3. CMake was 3.22.1 on Humble, 3.28.3 on Jazzy and 4.2.3 on Lyrical. The script is repro.sh in the evidence folder.
Two copies in src/: what colcon does
I copied src/pkg_a to src/pkg_a_old, which is what a quick backup looks like. Plain colcon build printed the error above and exited with code 1. install/ was not created, so pkg_b was not built either, even though it has nothing to do with pkg_a. colcon checks for duplicates before it starts any build job.
With three copies, the error lists all three paths under one name:
- pkg_a:
- src/pkg_a
- src/pkg_a_backup
- src/pkg_a_old
Here is what other flags did with the duplicate in place:
--continue-on-error: same error, exit 1. It applies to failed build jobs, and here no job started.colcon test: the same check, withcolcon test: Duplicate package names not supported:, exit 1.--packages-select pkg_b: builtpkg_b, exit 0. The check only applies to the packages you select.--packages-skip pkg_aand--packages-ignore pkg_a: both builtpkg_b, exit 0.--packages-select pkg_a: same error, exit 1. Naming the package does not say which copy you mean.
So if you only need to build other packages right now, skip the duplicated name. To build the duplicated package itself, you have to remove or hide one copy.
If you copied a whole workspace to a new path instead, see the CMakeCache.txt directory is different error.
Renaming the copy is also possible, but package.xml alone is not enough for ament_cmake. When I changed <name> to pkg_a_old but left project(pkg_a NONE), the duplicate error was gone, but the build failed with:
CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:53 (message):
ament_package_xml() package name 'pkg_a_old' in '/package.xml' does not
match current PROJECT_NAME 'pkg_a'. You must call project() with the same
package name before.
Changing both made all three packages build, exit 0.
Finding both copies with colcon list
colcon list does not fail on duplicates. It exited 0 and printed one row per folder, which is the quickest way to see where each copy lives:
$ colcon list
pkg_a src/pkg_a (ros.ament_cmake)
pkg_a src/pkg_a_old (ros.ament_cmake)
pkg_b src/pkg_b (ros.ament_cmake)
colcon list --names-only printed pkg_a twice. colcon list --paths-only printed the three folders. colcon info pkg_a printed a full block for each path, including the name: pkg_a field. A quick check for any workspace:
colcon list --names-only | sort | uniq -d
Any name it prints is a duplicate. Then run colcon list and look at the paths for that name.
Nested clones, the workspace root, and stray build folders
colcon looks for packages in every subfolder of the base path, which defaults to the current directory. A package cloned inside another repo, src/some_repo/pkg_a, clashed with src/pkg_a the same way. Putting an empty .git folder in src/some_repo did not change that.
The workspace root counts too. With a copy at /ws/pkg_a and another at /ws/src/pkg_a, running colcon build from /ws failed with:
- pkg_a:
- pkg_a
- src/pkg_a
That matches what people hit after running git clone in the workspace root and again in src/. colcon build --base-paths src built both packages, exit 0, because it stops colcon from scanning the root.
A copy in a hidden folder, src/.hidden_backup/pkg_a, was not picked up. The build passed with two packages. I didn't test other ways colcon might skip folders.
I also ran colcon build inside src/ by mistake. That created src/build, src/install and src/log, and colcon put a COLCON_IGNORE file in each one. The installed tree has a package.xml for each package under src/install/pkg_a/share/pkg_a/. Because of those marker files, the next colcon build from /ws still passed. Once I deleted the three COLCON_IGNORE files, it failed:
- pkg_a:
- src/install/pkg_a/share/pkg_a
- src/pkg_a
- pkg_b:
- src/install/pkg_b/share/pkg_b
- src/pkg_b
An old install/ copied into src/old_install behaved the same. With its COLCON_IGNORE it was ignored. Without it, every installed package showed up as a duplicate. If your error lists a path containing install/ or share/, that's the cause. Delete or move that folder; don't rename your packages.
Which ignore file works
I put each candidate file, empty, in the copy src/pkg_a_old and ran a plain colcon build. Same result on Humble, Jazzy and Lyrical:
| File in the copy | Result |
|---|---|
COLCON_IGNORE |
Copy ignored, 2 packages built, exit 0 |
AMENT_IGNORE |
Copy ignored, 2 packages built, exit 0 |
CATKIN_IGNORE |
Copy ignored, 2 packages built, exit 0 |
COLCON_IGNORE containing the text pkg_a |
Copy ignored, exit 0 |
colcon_ignore (lowercase) |
Duplicate error, exit 1 |
.colcon_ignore |
Duplicate error, exit 1 |
IGNORE |
Duplicate error, exit 1 |
The name is case-sensitive. A marker in a parent folder also works. With src/backup/pkg_a and an empty COLCON_IGNORE, AMENT_IGNORE or CATKIN_IGNORE in src/backup/, the build passed each time. That is handy if you keep several old copies in one folder.
Make sure the marker goes in the right copy. I put COLCON_IGNORE in the original src/pkg_a instead, and added a message() line to the copy's CMakeLists.txt. The build passed, and the log showed -- BUILDING_FROM_OLD_COPY. colcon built the old copy into install/pkg_a and said nothing about it.
If you also want to skip whole folders to speed up builds, I measured that separately in colcon build slow: overlays, COLCON_IGNORE and symlink-install.
Picking one copy with --paths or --base-paths
Both options limit discovery to the folders you name. They leave the duplicate in place.
colcon build --base-paths src/pkg_a src/pkg_b: 2 packages built, exit 0.colcon build --paths src/pkg_a src/pkg_b: 2 packages built, exit 0.colcon list --base-paths src/pkg_a src/pkg_blisted only those two.colcon list --paths src/pkg_a_oldlisted the copy with its absolute path,/ws/src/pkg_a_old.colcon build --paths 'src/pkg_*'(quoted, so the shell does not expand it) failed. colcon expanded the pattern itself and matched both copies. This time the error showed absolute paths,/ws/src/pkg_aand/ws/src/pkg_a_old.
The choice does not stick. After a successful --paths build, the next plain colcon build failed again with exit 1. If you don't want to type the paths every time, use an ignore file.
Overlay vs underlay: "already built in one or more underlay workspaces"
This is the case behind many tutorial questions, usually with turtlesim. Your workspace has a package that also exists in a sourced workspace such as /opt/ros/humble. colcon does not treat that as a duplicate. Duplicates only count inside the folders colcon is scanning.
With the images as shipped, nothing was printed. A src/std_msgs package in the overlay built next to pkg_a and pkg_b, exit 0. colcon extensions listed no override extension. The flag from the warning was rejected:
colcon: error: unrecognized arguments: --allow-overriding std_msgs
That exited with code 2. In all three images, python3-colcon-override-check was not installed. apt-cache depends python3-colcon-common-extensions lists it only under Recommends, not Depends.
After installing python3-colcon-override-check 0.0.1, which also installed colcon-installed-package-information 0.2.1, the same build printed:
[0.351s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'std_msgs' is in: /opt/ros/humble
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.
If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding std_msgs
This may be promoted to an error in a future release of colcon-override-check.
The text was the same on Jazzy and Lyrical, except for the path, /opt/ros/jazzy or /opt/ros/lyrical. After the warning, all three packages built, exit 0. If your build fails after this warning, the failure is a separate problem further down in the log.
--packages-select std_msgs: same warning, exit 0.--allow-overriding std_msgs: no warning, exit 0.--allow-overridingwith no name:colcon build: error: argument --allow-overriding: expected at least one argument, exit 2.--allow-overriding pkg_a, the wrong name: the warning forstd_msgsstill printed, exit 0.
The extension does not warn about every override. I built /ws with pkg_a, then a second workspace /ws_b with its own pkg_a, with /ws/install/setup.bash sourced. There was no warning, both for an isolated and for a --merge-install /ws. Then I added pkg_c to /ws with <exec_depend>pkg_a</exec_depend> and rebuilt it. Now the /ws_b build warned:
'pkg_a' is in: /ws/install/pkg_a
The installed override_check.py has the reason in a comment: # Of those, Ignore overrides which are (effectively) leaf packages. It only warns when some package in an underlay depends on the one you are overriding at run time. std_msgs in /opt/ros has many dependents, so it always warns. A leaf package does not.
Rebuilding a workspace after sourcing its own install/setup.bash gave no warning either, for isolated and merged installs. The extension drops packages that are in your own install base. After sourcing /ws and then /ws_b, ros2 pkg prefix pkg_a printed /ws_b/install/pkg_a, so the overlay copy wins.
Which copy an overlay sees also depends on the setup script you sourced: local_setup.bash vs setup.bash, measured.
Version notes
- The duplicate error text, exit codes, ignore-file results and
--pathsbehaviour were the same on Humble, Jazzy and Lyrical. All three images had colcon-core 0.21.3, so this is not surprising. - On Lyrical, the timestamp before
ERROR:colconandWARNING:colconwas a large negative number, for example[-1793325050478942720.000s], instead of[0.328s]. The message after it was identical. If you search logs for the error, search for the text, not the prefix. - On Lyrical (CMake 4.2.3), every package with
cmake_minimum_required(VERSION 3.8)printedCMake Deprecation Warning ... Compatibility with CMake < 3.10 will be removed from a future version of CMake.as stderr. The builds still passed. It is unrelated to duplicates, but it shows up in the same log. colcon-override-checkwas missing from all threeros-baseimages. The installed version was 0.0.1 on all three.
Not tested
ament_python, catkin and plain CMake packages. Mixed ROS 1 and ROS 2 workspaces, like the colcon test report linked below. --symlink-install and --merge-install with duplicates in src/. base-paths set in a defaults.yaml file or a mixin. Real header conflicts or ABI breakage from overriding a package, which the warning text describes. Symlinked package folders. Any colcon version other than colcon-core 0.21.3. Rolling and Kilted. Windows and macOS.
FAQ
What does "Duplicate package names not supported" mean?
colcon found more than one folder whose package.xml has the same <name> among the packages you selected. It lists each path and exits with code 1 before building anything, including unrelated packages.
How do I fix it without deleting the copy?
Put an empty file named COLCON_IGNORE in the folder you don't want built. AMENT_IGNORE and CATKIN_IGNORE also worked, and so did a marker in a parent folder. Lowercase colcon_ignore and .colcon_ignore did not. For a one-off build, --paths or --base-paths with the folders you want also worked.
Why does colcon list a path under install/ or share/ as a duplicate?
An installed tree contains a package.xml for each package. If an install/ folder sits under your base path without its COLCON_IGNORE file, colcon treats every installed package as a second copy. This happened after running colcon build inside src/ and after copying an old install/ into src/.
Is "already built in one or more underlay workspaces" an error?
No. The build continued and exited 0 on all three distros. It only appears when the colcon-override-check extension is installed, and only for packages that something in the underlay depends on. Add --allow-overriding with the package name to silence it. If the build fails afterwards, the real error is further down the log.
Why does colcon say unrecognized arguments: --allow-overriding?
The flag comes from the colcon-override-check extension, which was not installed in the official ros-base images. Without it, colcon exits with code 2. Install python3-colcon-override-check, or just drop the flag, since without the extension there is no warning to silence.
Measured on 2026-10-30 with ros:humble-ros-base (sha256:d9bcf2e6f72d..., CMake 3.22.1), ros:jazzy-ros-base (sha256:8eed0a4669bb..., CMake 3.28.3) and ros:lyrical-ros-base (sha256:3224ee150cb0..., CMake 4.2.3). All three had colcon-core 0.21.3, colcon-cmake 0.2.30, colcon-package-selection 0.2.10 and colcon-recursive-crawl 0.2.3, plus colcon-override-check 0.0.1 where installed for the underlay tests. Full digests are in digests.txt.
Script and raw output: evidence folder. Questions this answers: kiss-icp: problem with build for ROS2 (kiss_icp in kiss-icp/ros and src/kiss-icp/ros), colcon test: Duplicate package names not supported in a ROS 1 and ROS 2 workspace, colcon build: Duplicate package names not supported (course sections in one workspace), Humble tutorial creating a workspace, How to remove same name package that the result of colcon build in another workspace?, colcon can't build turtlesim.