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

**URL:** <https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390>\
**Category:** Code\
**Created:** [April 6, 2022, 8:15pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390 "2022-04-06T20:15:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [April 6, 2022, 8:15pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/1 "2022-04-06T20:15:31Z")

</div>

```bash
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$ 

```

---

<div class="post-metadata">

**Author:** ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)\
**Post date:** [April 6, 2022, 8:18pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/2 "2022-04-06T20:18:18Z")

</div>

Yeah, the error messages are atrocious. We have an [open issue](https://gitlab.kitware.com/cmake/cmake/-/issues/21310) 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.

---

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [April 6, 2022, 8:49pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/3 "2022-04-06T20:49:23Z")

</div>

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

```diff
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",

```

---

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [April 6, 2022, 8:57pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/4 "2022-04-06T20:57:55Z")

</div>

this is the simples version with the error:

```json
{
    "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"
            }
        }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)\
**Post date:** [April 6, 2022, 9:02pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/5 "2022-04-06T21:02:18Z")

</div>

> [@kyle.edwards](#):
>
> If you post your file, I might be able to help you.

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

---

<div class="post-metadata">

**Author:** ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)\
**Post date:** [April 13, 2022, 6:21pm UTC](https://discourse.cmake.org/t/how-to-find-the-problem-with-an-invalid-preset-cmake-message/5390/6 "2022-04-13T18:21:38Z")

</div>

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.
