Icinga / Icinga/icinga2

Error message when constants are defined twice is not helpful

Open
#10,993 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/configuration
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.