How to find the problem with an "Invalid preset" cmake message?

bash-3.2$ jsonschema -i CMakePresets.json -o pretty schemaCMakePrests.json 
===[SUCCESS]===(CMakePresets.json)===
bash-3.2$ cmake . --list-presets=all
CMake Error: Could not read presets from /Users/clausklein/Workspace/cpp/cpp_boilerplate_project: Invalid preset
bash-3.2$ 

Yeah, the error messages are atrocious. We have an open issue on GitLab for this. It’s my single biggest regret about this feature.

If you post your file, I might be able to help you.

that’s quit simple, modify the name of an inherited preset:

diff --git a/CMakePresets.json b/CMakePresets.json
index 807b24e..d3eb175 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -7,7 +7,7 @@
     },
     "configurePresets": [
         {
-            "name": "common",
+            "name": "XXX-common",
             "description": "General settings that apply to all configurations",
             "hidden": true,
             "generator": "Ninja Multi-Config",

this is the simples version with the error:

{
    "version": 3,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 21,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "XXX-common",
            "description": "General settings that apply to all configurations",
            "hidden": true,
            "generator": "Ninja Multi-Config",
            "binaryDir": "${sourceDir}/build",
            "installDir": "${sourceDir}/out/stage"
        },
        {
            "name": "windows-common",
            "description": "Windows settings for MSBuild toolchain that apply to msvc and clang",
            "inherits": "common",
            "cacheVariables": {
                "ENABLE_CPPCHECK_DEFAULT": "FALSE",
                "ENABLE_CLANG_TIDY_DEFAULT": "FALSE"
            }
        }
    ]
}

Today, I know the reason, but yesterday I was confused to find it!

Yes, my approach has been to nibble pieces out of the file until I get down to something minimal enough that works. However, as the presets feature set grows including files etc, it has gotten to where any granular improvement could be a big help in the error messages.