Error message when constants are defined twice is not helpful
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 616
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
If you happen to try to define the same constant twice in your Icinga 2 configuration, the resulting config validation error is absolutely not helpful.
How to reproduce
Append the following to /etc/icinga2/constants.conf:
const NotHelpful = 1
const NotHelpful = 2
And run icinga2 daemon -C.
Current behavior
It results in a config validation error, but if you don't know the cause, it's quite unclear why.
[2026-08-13 12:36:37 +0000] information/cli: Icinga application loader (version: v2.16.4)
[2026-08-13 12:36:37 +0000] information/cli: Loading configuration file(s).
[2026-08-13 12:36:37 +0000] critical/config: Error: Constant must not be modified.
[2026-08-13 12:36:37 +0000] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
Expected behavior
The error should point at the constant being modified, showing the code location in the config like with other validation errors. Ideally, it should show both locations where the constant was (first) defined and where it was modified.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by appending the duplicate definitions to /etc/icinga2/constants.conf and running icinga2 daemon -C. Start at this configuration-validation entry point and trace the reported constant error; done means the validation output identifies the modified constant and shows both definition locations when available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100