netdata/netdata · warning

warning: no configuration file has been loaded. Use -c CONFI

Error message

warning: no configuration file has been loaded. Use -c CONFIG_FILE, before -W get. Using default config.\n

What it means

Warning emitted by the '-W get' handler when no configuration file was loaded (the config_loaded flag is false) before the -W get option was processed. It is non-fatal: netdata_conf_load(NULL, 0, &user) then loads the default configuration (built-in defaults, possibly the default /etc/netdata/netdata.conf path), so the printed value may reflect defaults rather than your actual file.

Source

Thrown at src/daemon/main.c:909

                            // variables at netdata.conf
                            inicfg_set_default_raw_value(tmp_config, section, key, value);

                            // fprintf(stderr, "SET section '%s', key '%s', value '%s'\n", section, key, value);
                        }
                        else if(strcmp(optarg, "get") == 0) {
                            if(optind + 3 > argc) {
                                fprintf(stderr, "%s", "\nUSAGE: -W get 'section' 'key' 'value'\n\n"
                                        " Prints settings of netdata.conf.\n"
                                        "\n"
                                        " These options interact with: -c netdata.conf\n"
                                        " -c netdata.conf has to be given before -W get.\n"
                                        "\n"
                                );
                                return 1;
                            }

                            if(!config_loaded) {
                                fprintf(stderr, "warning: no configuration file has been loaded. Use -c CONFIG_FILE, before -W get. Using default config.\n");
                                netdata_conf_load(NULL, 0, &user);
                            }

                            netdata_conf_section_global();

                            const char *section = argv[optind];
                            const char *key = argv[optind + 1];
                            const char *def = argv[optind + 2];
                            const char *value = inicfg_get(&netdata_config, section, key, def);
                            printf("%s\n", value);
                            return 0;
                        }
                        else if(strcmp(optarg, "get2") == 0) {
                            if(optind + 4 > argc) {
                                fprintf(stderr, "%s", "\nUSAGE: -W get2 'conf_file' 'section' 'key' 'value'\n\n"
                                        " Prints settings of netdata.conf or cloud.conf\n"
                                        "\n"
                                        " These options interact with: -c netdata.conf\n"

View on GitHub (pinned to 4864de85e2)

Solutions

  1. Put -c BEFORE -W get: netdata -c /etc/netdata/netdata.conf -W get global history 3600
  2. Verify the config file path exists and is readable
  3. Treat this warning as a signal that the value shown may be a default, not your configured value
  4. If the file is elsewhere (e.g. custom install prefix), pass its full path to -c

Example fix

# before
netdata -W get global history 3600 -c /etc/netdata/netdata.conf
# after
netdata -c /etc/netdata/netdata.conf -W get global history 3600
Defensive patterns

Strategy: validation

Validate before calling

# bash: guarantee a config is loaded before the read
cfg=/etc/netdata/netdata.conf
[ -r "$cfg" ] || { echo "config not readable: $cfg" >&2; exit 1; }
netdata -c "$cfg" -W get global history 3600

Try / catch

out=$(netdata -W get global history 3600 2>&1 >/dev/null); case "$out" in *warning:*no\ configuration*) echo "default config in use" >&2;; esac

Prevention

When it happens

Trigger: Running 'netdata -W get section key default' without a preceding '-c CONFIG_FILE' on the same command line. Because getopt processes options in order and -W get executes immediately during parsing, a '-c' appearing AFTER '-W get' on the command line has not been processed yet and does not count.

Common situations: Checking an option before loading the config in scripts; placing -c netdata.conf after the -W get tokens; running in an environment where /etc/netdata/netdata.conf does not exist so even the fallback load finds nothing and built-in defaults are printed.

Related errors


AI-assisted analysis of netdata/netdata@4864de85e2 (2026-08-15). Data as JSON: /api/errors/3c13299302b567c5. Report an issue: GitHub.