Repository: conan-io/conan

Issue:
[bug] AssertionError
### Describe the bug

```shell
version: 2.18.0-dev
conan_path: C:\Users\Todiq\Documents\CAST\venv\Scripts\conan
python
  version: 3.9.13
  sys_version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
  sys_executable: C:\Users\Todi\Documents\CAST\venv\Scripts\python.exe
  is_frozen: False
  architecture: AMD64
system
  version: 10.0.26100
  platform: Windows-10-10.0.26100-SP0
  system: Windows
  release: 10
  cpu: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
```

### How to reproduce it

Hello,

I know I don't provide a lot of context for now.
I tried moving some code from my recipes to a `python-requires` using the new `CMakeDeps`, but an error just occured, which is not very explicit for the user to debug.

Here is the full log:

### Logs

<details><summary>Click to expand log</summary>

```shell
conan build -pr:a msvc -c "tools.cmake.cmakedeps:new=will_break_next" -vv .\framework\

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
core:required_conan_version=>=2.9.3
tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
tools.cmake.cmakedeps:new=will_break_next
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.env.virtualenv:powershell=powershell

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
core:required_conan_version=>=2.9.3
tools.cmake.cmake_layout:build_folder_vars=['settings.os', 'settings.compiler', 'settings.compiler.version', 'settings.arch']
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
tools.env.virtualenv:powershell=powershell


======== Computing dependency graph ========
boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

Graph root
    conanfile.py (castframework/0.1): C:\Users\Todiq\Documents\CAST\Carl\framework\conanfile.py
Requirements
    boost/1.85.0#6424237750468277a71705060c8972aa - Cache
    castbasetest/0.1 - Editable
    castcore/0.1 - Editable
    castdbconnectivity/0.1 - Editable
    castmetamodel/0.1 - Editable
    castparsing/0.1 - Editable
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c - Cache
    icu/75.1#6f9c2fb7dbc2c641897992599c6768bc - Cache
    libpq/14.5#446fdb31537dd39aeb84573a2fa5a86f - Cache
    libxml2/2.12.7#1c4d20b7ab8b618ce699733723ba4df6 - Cache
    libxslt/1.1.39#f234ec863386b119ecc1834e6752f9e4 - Cache
    pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91 - Cache
    rapidjson/cci.20230929#8dc0392af2b3aaea7312095f0ba53467 - Cache
    xerces-c/3.2.5#4534bf5ce931e79773601ba912a963a6 - Cache
    zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76 - Cache
Test requirements
    castbasetest/0.1 - Editable
    castmessageresources/0.1 - Editable
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c - Cache
Build requirements
    b2/5.2.1#91bc73931a0acb655947a81569ed8b80 - Cache
    boost/1.85.0#6424237750468277a71705060c8972aa - Cache
    castbasetest/0.1 - Editable
    castcore/0.1 - Editable
    castmessageresources/0.1 - Editable
    castmetamodel/0.1 - Editable
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c - Cache
    icu/75.1#6f9c2fb7dbc2c641897992599c6768bc - Cache
    libxml2/2.12.7#1c4d20b7ab8b618ce699733723ba4df6 - Cache
    libxslt/1.1.39#f234ec863386b119ecc1834e6752f9e4 - Cache
    msys2/cci.latest#4927aa5502eb174e95df524f2be2685e - Cache
    pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91 - Cache
    rapidjson/cci.20230929#8dc0392af2b3aaea7312095f0ba53467 - Cache
    strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41 - Cache
    xerces-c/3.2.5#4534bf5ce931e79773601ba912a963a6 - Cache
Python requires
    pyreq/0.1#32ab1cbc9cc81a787503a574585fd240 - Cache
Resolved version ranges
    b2/[>=5.2 <6]: b2/5.2.1
    castbasetest/[>=0.1 <1.0]: castbasetest/0.1
    castcore/[>=0.1 <1.0]: castcore/0.1
    castdbconnectivity/[>=0.1 <1.0]: castdbconnectivity/0.1
    castmessageresources/[>=0.1 <1.0]: castmessageresources/0.1
    castmetamodel/[>=0.1 <1.0]: castmetamodel/0.1
    castparsing/[>=0.1 <1.0]: castparsing/0.1

======== Computing necessary packages ========
Connecting to remote 'cast' anonymously
Connecting to remote 'conancenter' anonymously
Connecting to remote 'carl-conan-packages-local' with user 'nightlybuild'
zlib/1.3.1: Main binary package '19e318a866610969ae17aaa36552350ac86725f0' missing
zlib/1.3.1: Checking 1 compatible configurations
zlib/1.3.1: Found compatible package 'f7dcd1cec4586c154a242a765a1de011300db8e2': compiler.version=193
icu/75.1: Compatible package ID ac4210d16514aef42cfbde4b63705596944fa23f equal to the default package ID: Skipping it.
icu/75.1: Main binary package 'ac4210d16514aef42cfbde4b63705596944fa23f' missing
icu/75.1: Checking 5 compatible configurations
icu/75.1: Found compatible package 'dc4e6a2eddc63fa27fdc4d7532086ac86dc92a8f': compiler.version=193
libpq/14.5: Main binary package '7cc294e504e42c968138d497976f8b097d521736' missing
libpq/14.5: Checking 1 compatible configurations
libpq/14.5: Found compatible package '31ec133a00b61170cf3cf7794361cfe75bf9405e': compiler.version=193
Requirements
    boost/1.85.0#6424237750468277a71705060c8972aa:4a8aa0aee3570f682dc50c9b970c04420df92db6#7727e72df5d52080a8a597071a53d33d - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: asio_no_deprecated=False buildid=None bzip2=False diagnostic_definitions=False error_code_header_only=False extra_b2_flags=None filesystem_no_deprecated=False filesystem_use_std_fs=False header_only=False i18n_backend_iconv=off i18n_backend_icu=False layout=system lzma=False magic_autolink=False multithreading=True namespace=boost namespace_alias=False python_buildid=None python_version=3.9 segmented_stacks=False shared=True system_no_deprecated=False system_use_utf8=False visibility=hidden without_atomic=False without_charconv=True without_chrono=False without_cobalt=True without_container=False without_context=True without_contract=True without_coroutine=True without_date_time=False without_exception=False without_fiber=True without_filesystem=False without_graph=True without_graph_parallel=True without_iostreams=False without_json=True without_locale=False without_log=False without_math=True without_mpi=True without_nowide=True without_program_options=False without_python=False without_random=False without_regex=False without_serialization=True without_stacktrace=True without_system=False without_test=True without_thread=False without_timer=True without_type_erasure=True without_url=True without_wave=True zlib=False zstd=False
    castbasetest/0.1:4188a3b694e19e40df6cf34260c637c354c704a2 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=False
        python_requires: pyreq/0.1.Z
    castcore/0.1:6fd48934d23bfcfee6e82765e5819ee187324394 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: boost/1.85.Z icu/75.1.Z libxslt/1.1.Z libxml2/2.12.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709 rapidjson/cci xerces-c/3.2.Z
        python_requires: pyreq/0.1.Z
    castdbconnectivity/0.1:9202e8f752c8544846e038e3423c6dc434b2e9bc - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709 rapidjson/cci xerces-c/3.2.Z libpq/14.5.Z
        python_requires: pyreq/0.1.Z
    castmetamodel/0.1:d4571f65639f8b8016998da5eafc47c31103139b - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z libxml2/2.12.Z rapidjson/cci xerces-c/3.2.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709
        python_requires: pyreq/0.1.Z
    castparsing/0.1:86df93e362102b7a9a0b23e63b10f68b24ce330a - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709 rapidjson/cci xerces-c/3.2.Z zlib/1.3.Z
        python_requires: pyreq/0.1.Z
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c:6156981eb0711128a3a30ca9bcda2725dd72f43e#5b20527174ab07561d5caaea6106d727 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: build_gmock=True disable_pthreads=False hide_symbols=False shared=False
    icu/75.1#6f9c2fb7dbc2c641897992599c6768bc:dc4e6a2eddc63fa27fdc4d7532086ac86dc92a8f#c199016c771169ebbeb087bb9ddd83cc - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 build_type=Release
        options: dat_package_file=None shared=True with_dyload=True with_extras=False with_icuio=True
        compatibility_delta: settings=[('compiler.cppstd', '17'), ('compiler.version', '193')]
    libpq/14.5#446fdb31537dd39aeb84573a2fa5a86f:31ec133a00b61170cf3cf7794361cfe75bf9405e#493aebf2d0b7420cb1b864e37758cb76 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 build_type=Release
        options: shared=True with_openssl=False
        compatibility_delta: settings=[('compiler.version', '193')]
    libxml2/2.12.7#1c4d20b7ab8b618ce699733723ba4df6:e4b3e515c51b1428e6241413347309d82ed179ab#a79438ad57b8b8321ed0e100631a6aa3 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: c14n=True catalog=True ftp=True html=True http=True iconv=False icu=False include_utils=True iso8859x=True legacy=True lzma=False mem-debug=False output=True pattern=True push=True python=False reader=True regexps=True sax1=True schemas=True schematron=True shared=True threads=True tree=True valid=True writer=True xinclude=True xpath=True xptr=True zlib=False
    libxslt/1.1.39#f234ec863386b119ecc1834e6752f9e4:13fd157302947052f8a0677a56022042f6fae1e1#382cf1e4b2558269331fa7d3ea0ba723 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: crypto=False debugger=False plugins=False profiler=False shared=True
        requires: libxml2/2.12.Z
    pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709#af9f172e7c10bbfa2e1f6597b9b407da - Cache
    rapidjson/cci.20230929#8dc0392af2b3aaea7312095f0ba53467:da39a3ee5e6b4b0d3255bfef95601890afd80709#bc6124f3dda366933f5ac97f53b76b7b - Cache
    xerces-c/3.2.5#4534bf5ce931e79773601ba912a963a6:7ab73b8e443eac2f8636df07f539a599c86a90f1#c22609f706a0c9be778f06c48bfd88bd - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: char_type=char16_t message_loader=inmemory mutex_manager=windows network=False shared=True transcoder=windows
    zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76:f7dcd1cec4586c154a242a765a1de011300db8e2#e09e74da8b1c1b7dc7d873a0395cda93 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 build_type=Release
        options: shared=True
        compatibility_delta: settings=[('compiler.version', '193')]
Test requirements
    castbasetest/0.1:4188a3b694e19e40df6cf34260c637c354c704a2 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=False
        python_requires: pyreq/0.1.Z
    castmessageresources/0.1:1c510f6848caf52dd1226d5dbbf859bc6c5c3b52 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z rapidjson/cci xerces-c/3.2.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709
        python_requires: pyreq/0.1.Z
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c:6156981eb0711128a3a30ca9bcda2725dd72f43e#5b20527174ab07561d5caaea6106d727 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: build_gmock=True disable_pthreads=False hide_symbols=False shared=False
Build requirements
    b2/5.2.1#91bc73931a0acb655947a81569ed8b80:522dcea5982a3f8a5b624c16477e47195da2f84f#5f19dadaa36632e4f4999a053c9edf2c - Skip
        settings: os=Windows arch=x86_64
    boost/1.85.0#6424237750468277a71705060c8972aa:4a8aa0aee3570f682dc50c9b970c04420df92db6#7727e72df5d52080a8a597071a53d33d - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: asio_no_deprecated=False buildid=None bzip2=False diagnostic_definitions=False error_code_header_only=False extra_b2_flags=None filesystem_no_deprecated=False filesystem_use_std_fs=False header_only=False i18n_backend_iconv=off i18n_backend_icu=False layout=system lzma=False magic_autolink=False multithreading=True namespace=boost namespace_alias=False python_buildid=None python_version=3.9 segmented_stacks=False shared=True system_no_deprecated=False system_use_utf8=False visibility=hidden without_atomic=False without_charconv=True without_chrono=False without_cobalt=True without_container=False without_context=True without_contract=True without_coroutine=True without_date_time=False without_exception=False without_fiber=True without_filesystem=False without_graph=True without_graph_parallel=True without_iostreams=False without_json=True without_locale=False without_log=False without_math=True without_mpi=True without_nowide=True without_program_options=False without_python=False without_random=False without_regex=False without_serialization=True without_stacktrace=True without_system=False without_test=True without_thread=False without_timer=True without_type_erasure=True without_url=True without_wave=True zlib=False zstd=False
    castbasetest/0.1:4188a3b694e19e40df6cf34260c637c354c704a2 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=False
        python_requires: pyreq/0.1.Z
    castcore/0.1:6fd48934d23bfcfee6e82765e5819ee187324394 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: boost/1.85.Z icu/75.1.Z libxslt/1.1.Z libxml2/2.12.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709 rapidjson/cci xerces-c/3.2.Z
        python_requires: pyreq/0.1.Z
    castmessageresources/0.1:1c510f6848caf52dd1226d5dbbf859bc6c5c3b52 - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z rapidjson/cci xerces-c/3.2.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709
        python_requires: pyreq/0.1.Z
    castmetamodel/0.1:d4571f65639f8b8016998da5eafc47c31103139b - Editable
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: shared=True
        requires: castcore/0.1.Z boost/1.85.Z icu/75.1.Z libxml2/2.12.Z rapidjson/cci xerces-c/3.2.Z pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709
        python_requires: pyreq/0.1.Z
    gtest/1.14.0#25e2a474b4d1aecf5ff4f0555dcdf72c:6156981eb0711128a3a30ca9bcda2725dd72f43e#5b20527174ab07561d5caaea6106d727 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: build_gmock=True disable_pthreads=False hide_symbols=False shared=False
    icu/75.1#6f9c2fb7dbc2c641897992599c6768bc:dc4e6a2eddc63fa27fdc4d7532086ac86dc92a8f#c199016c771169ebbeb087bb9ddd83cc - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: dat_package_file=None shared=True with_dyload=True with_extras=False with_icuio=True
    libxml2/2.12.7#1c4d20b7ab8b618ce699733723ba4df6:e4b3e515c51b1428e6241413347309d82ed179ab#a79438ad57b8b8321ed0e100631a6aa3 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: c14n=True catalog=True ftp=True html=True http=True iconv=False icu=False include_utils=True iso8859x=True legacy=True lzma=False mem-debug=False output=True pattern=True push=True python=False reader=True regexps=True sax1=True schemas=True schematron=True shared=True threads=True tree=True valid=True writer=True xinclude=True xpath=True xptr=True zlib=False
    libxslt/1.1.39#f234ec863386b119ecc1834e6752f9e4:13fd157302947052f8a0677a56022042f6fae1e1#382cf1e4b2558269331fa7d3ea0ba723 - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: crypto=False debugger=False plugins=False profiler=False shared=True
        requires: libxml2/2.12.Z
    msys2/cci.latest#4927aa5502eb174e95df524f2be2685e:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#06ca1e71ba3ed86c0b2e116f4a63da61 - Skip
        settings: os=Windows arch=x86_64
        options: additional_packages=None exclude_files=*/link.exe packages=base-devel,binutils,gcc
    pugixml/1.14#c6afdcf73d71858303d8260b0d76ff91:da39a3ee5e6b4b0d3255bfef95601890afd80709#af9f172e7c10bbfa2e1f6597b9b407da - Cache
    rapidjson/cci.20230929#8dc0392af2b3aaea7312095f0ba53467:da39a3ee5e6b4b0d3255bfef95601890afd80709#bc6124f3dda366933f5ac97f53b76b7b - Cache
    strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41:522dcea5982a3f8a5b624c16477e47195da2f84f#a365b3810f698e2f0a00fbeece022903 - Skip
        settings: os=Windows arch=x86_64
    xerces-c/3.2.5#4534bf5ce931e79773601ba912a963a6:7ab73b8e443eac2f8636df07f539a599c86a90f1#c22609f706a0c9be778f06c48bfd88bd - Cache
        settings: os=Windows arch=x86_64 compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=194 build_type=Release
        options: char_type=char16_t message_loader=inmemory mutex_manager=windows network=False shared=True transcoder=windows

======== Installing packages ========
gtest/1.14.0: Already installed! (2 of 16)
libxml2/2.12.7: Already installed! (3 of 16)
libxml2/2.12.7: Appending PATH environment variable: C:\Users\Todiq\Documents\CAST\conan\p\libxm033e384cb7c0a\p\bin
libxml2/2.12.7: Appending PATH environment variable: C:\Users\Todiq\Documents\CAST\conan\p\libxm033e384cb7c0a\p\bin
libxml2/2.12.7: Appending PATH environment variable: C:\Users\Todiq\Documents\CAST\conan\p\libxm033e384cb7c0a\p\bin
pugixml/1.14: Already installed! (4 of 16)
rapidjson/cci.20230929: Already installed! (5 of 16)
xerces-c/3.2.5: Already installed! (6 of 16)
zlib/1.3.1: Already installed! (7 of 16)
boost/1.85.0: Already installed! (8 of 16)
boost/1.85.0: Disabled magic autolinking (smart and magic decisions)
boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: Disabled magic autolinking (smart and magic decisions)
boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: Disabled magic autolinking (smart and magic decisions)
boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

boost/1.85.0: running "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: RUN: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"
boost/1.85.0: Full command: "C:/Users/Todiq/Documents/CAST/venv/Scripts/python.exe" -c "from __future__ import print_function; import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))"

icu/75.1: Already installed! (9 of 16)
libpq/14.5: Already installed! (10 of 16)
libxslt/1.1.39: Already installed! (11 of 16)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'cpp_info.names' used in: gtest/1.14.0, zlib/1.3.1, boost/1.85.0, icu/75.1, libpq/14.5, rapidjson/cci.20230929, libxslt/1.1.39, libxml2/2.12.7
WARN: deprecated:     'env_info' used in: boost/1.85.0, icu/75.1, libpq/14.5, libxslt/1.1.39, libxml2/2.12.7
WARN: deprecated:     'cpp_info.filenames' used in: boost/1.85.0, libxml2/2.12.7
WARN: deprecated:     'cpp_info.build_modules' used in: libxml2/2.12.7
WARN: deprecated:     'user_info' used in: boost/1.85.0

======== Finalizing install (deploy, generators) ========
conanfile.py (castframework/0.1): Calling generate()
conanfile.py (castframework/0.1): Generators folder: C:\Users\Todiq\Documents\CAST\Carl\framework\build\windows-msvc-194-x86_64\generators
conanfile.py (castframework/0.1): CMakeToolchain generated: conan_toolchain.cmake
conanfile.py (castframework/0.1): CMakeToolchain: Preset 'conan-windows-msvc-194-x86_64' added to CMakePresets.json.
    (cmake>=3.23) cmake --preset conan-windows-msvc-194-x86_64
    (cmake<3.23) cmake <path> -G "Ninja Multi-Config" -DCMAKE_TOOLCHAIN_FILE=generators\conan_toolchain.cmake  -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
conanfile.py (castframework/0.1): CMakeToolchain generated: C:\Users\Todiq\Documents\CAST\Carl\framework\build\windows-msvc-194-x86_64\generators\CMakePresets.json
conanfile.py (castframework/0.1): CMakeToolchain generated: C:\Users\Todiq\Documents\CAST\Carl\framework\CMakeUserPresets.json
conanfile.py (castframework/0.1): WARN: Using the new CMakeConfigDeps generator, behind the 'tools.cmake.cmakedeps:new' gate conf. This conf will change next release, breaking, so use it only for testing and dev
ERROR: Traceback (most recent call last):
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\internal\errors.py", line 35, in conanfile_exception_formatter
    yield
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\internal\api\install\generators.py", line 126, in write_generators
    conanfile.generate()
  File "C:\Users\Todiq\Documents\CAST\conan\p\pyreq62e24b51a3f4e\e\conanfile.py", line 41, in generate
    cd.generate()
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\cmakedeps.py", line 43, in generate
    generator_files = self._content()
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\cmakedeps.py", line 79, in _content
    ret[target_configuration.filename] = target_configuration.content()
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\target_configuration.py", line 32, in content
    return t.render(self._context)
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\target_configuration.py", line 113, in _context
    libs = self._get_libs(cpp_info, pkg_name, pkg_folder, pkg_folder_var)
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\target_configuration.py", line 158, in _get_libs
    target = self._get_cmake_lib(component, cpp_info.components, pkg_folder,
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\target_configuration.py", line 176, in _get_cmake_lib
    requires = self._requires(info, components)
  File "C:\Users\Todiq\Documents\CAST\tmp\conan\conan\tools\cmake\cmakedeps2\target_configuration.py", line 81, in _requires
    assert required_pkg == required_comp
AssertionError

conanfile.py (castframework/0.1): Error in generate() method, line 41
        cd.generate()
        AssertionError:
```

</details>

I must obviously have done something wrong in one of my packages composing my tree, but I would appreciate having a more explicit error to be able to fix it. Could you please have a look? Thanks in advance!



Discussion:
Thanks for the feedback @Todiq 

I am doing https://github.com/conan-io/conan/pull/18558 to print some more information in that assertion.

It seems that your package has some ``cpp_info.requires.requires("other_pkg::other_comp")`` or ``cpp_info.components["mycomp"].requires("other_pkg::other_comp")``, for a component ``other_comp`` that doesn't seem to exist in the ``other_pkg`` package.

Please let us know after the PR is merged, maybe we want to turn that assert into a full ``ConanException`` for a better diagnosing of this situation.
https://github.com/conan-io/conan/pull/18558 merged, if you update ``develop2`` branch and run again, you should see info about the specific package and component.
It really helped. Thanks a lot!

I am ensure whether you want the ticket to be closed to try the `ConanException`, though
So can you confirm that it was an incorrect input, because of a non-existing component in the dependency?

If that is the case, yes, I'd prefer to wait, and convert that assert to an exception for the proper message for other users that might do the same mistake.
Yes, that was exactly the issue!



Patch:
diff --git a/conan/tools/cmake/cmakedeps2/target_configuration.py b/conan/tools/cmake/cmakedeps2/target_configuration.py
index cfc7a1e3d91..9b7bdc033bc 100644
--- a/conan/tools/cmake/cmakedeps2/target_configuration.py
+++ b/conan/tools/cmake/cmakedeps2/target_configuration.py
@@ -78,9 +78,11 @@ def _requires(self, info, components):
                     dep_comp = dep.cpp_info.components.get(required_comp)
                     if dep_comp is None:
                         # It must be the interface pkgname::pkgname target
-                        assert required_pkg == required_comp, \
-                            (f"{self._conanfile}: Required package '{required_pkg}' != "
-                             f"Required component: {required_comp} for not found component")
+                        if required_pkg != required_comp:
+                            msg = (f"{self._conanfile} recipe cpp_info did .requires to "
+                                   f"'{required_pkg}::{required_comp}' but component "
+                                   f"'{required_comp}' not found in {required_pkg}")
+                            raise ConanException(msg)
                         comp = None
                         default_target = f"{dep.ref.name}::{dep.ref.name}"  # replace_requires
                         link = pkg_type is not PackageType.SHARED


Test patch:
diff --git a/test/integration/toolchains/cmake/cmakedeps2/test_cmakedeps.py b/test/integration/toolchains/cmake/cmakedeps2/test_cmakedeps.py
index 6639dc44f64..887d7b055d4 100644
--- a/test/integration/toolchains/cmake/cmakedeps2/test_cmakedeps.py
+++ b/test/integration/toolchains/cmake/cmakedeps2/test_cmakedeps.py
@@ -1,8 +1,6 @@
 import re
 import textwrap
 
-import pytest
-
 from conan.test.assets.genconanfile import GenConanfile
 from conan.test.utils.tools import TestClient
 
@@ -85,8 +83,10 @@ class PkgConan(ConanFile):
     cmake_paths = c.load("conan_cmakedeps_paths.cmake")
     assert re.search(r"list\(PREPEND CMAKE_PROGRAM_PATH \".*/libb.*/p/binb\"\)", cmake_paths)
     assert not re.search(r"list\(PREPEND CMAKE_PROGRAM_PATH /bina\"", cmake_paths)
-    assert re.search(r"list\(PREPEND CMAKE_LIBRARY_PATH \".*/libb.*/p/libb\" \".*/liba.*/p/liba\"\)", cmake_paths)
-    assert re.search(r"list\(PREPEND CMAKE_INCLUDE_PATH \".*/libb.*/p/includeb\" \".*/liba.*/p/includea\"\)", cmake_paths)
+    assert re.search(r"list\(PREPEND CMAKE_LIBRARY_PATH \".*/libb.*/p/libb\" \".*/liba.*/p/liba\"\)",
+                     cmake_paths)
+    assert re.search(r"list\(PREPEND CMAKE_INCLUDE_PATH \".*/libb.*/p/includeb\" "
+                     r"\".*/liba.*/p/includea\"\)", cmake_paths)
 
 
 def test_cmakedeps_deployer_relative_paths():
@@ -253,7 +253,7 @@ def package_info(self):
                                                        .with_generator("CMakeDeps")})
     c.run("create . --name=pkg --version=0.1")
     assert "CMakeDeps: cmake_set_interface_link_directories is legacy, not necessary" in c.out
-    c.run("create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
+    c.run(f"create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new={new_value}")
     assert "CMakeConfigDeps: cmake_set_interface_link_directories deprecated and invalid. " \
            "The package 'package_info()' must correctly define the (CPS) information" in c.out
 
@@ -271,7 +271,7 @@ def package_info(self):
             "test_package/conanfile.py": GenConanfile().with_settings("build_type")
                                                        .with_test("pass")
                                                        .with_generator("CMakeDeps")})
-    c.run("create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
+    c.run(f"create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new={new_value}")
     # it doesn't break
     assert "find_package(pkg)" in c.out
 
@@ -300,12 +300,34 @@ def package_info(self):
                                                            .with_test("pass")
                                                            .with_generator("CMakeDeps")})
     c.run("create dep")
-    c.run("create pkg --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
+    c.run(f"create pkg --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new={new_value}")
     # it doesn't break
     assert "find_package(pkg)" in c.out
 
 
-def test_consuming_cpp_info_transitively_by_requiring_root_component_in_another_component_from_another_package():
+def test_error_incorrect_component():
+    # https://github.com/conan-io/conan/issues/18554
+    c = TestClient()
+    conanfile = textwrap.dedent("""
+        from conan import ConanFile
+        class Pkg(ConanFile):
+            requires = "dep/0.1"
+            def package_info(self):
+                self.cpp_info.requires = ['dep::lib']
+        """)
+    c.save({"dep/conanfile.py": GenConanfile("dep", "0.1"),
+            "pkg/conanfile.py": conanfile,
+            "pkg/test_package/conanfile.py": GenConanfile().with_settings("build_type")
+                                                           .with_generator("CMakeDeps")
+                                                           .with_test("pass")})
+    c.run("create dep")
+    c.run(f"create pkg --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new={new_value}",
+          assert_error=True)
+    assert ("ERROR: Error in generator 'CMakeDeps': pkg/0.1 recipe cpp_info did .requires to "
+            "'dep::lib' but component 'lib' not found in dep") in c.out
+
+
+def test_consuming_cpp_info_transitively_by_requiring_root_component():
     c = TestClient()
     dependent_conanfile = textwrap.dedent("""
         from conan import ConanFile
@@ -339,8 +361,9 @@ def test(self):
     c.save({"dependent/conanfile.py": dependent_conanfile,
             "main/conanfile.py": conanfile,
             "main/test_package/conanfile.py":test_package})
-    c.run("create ./dependent/ --name=dependent --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
-    c.run("create ./main/ --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
+    c.run("create ./dependent/ --name=dependent --version=0.1 "
+          f"-c tools.cmake.cmakedeps:new={new_value}")
+    c.run(f"create ./main/ --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new={new_value}")
 
 
 def test_cmake_find_mode_deprecated():