netdata/netdata · error

missing value for %s

Error message

missing value for %s

What it means

Emitted by the network-viewer.plugin test CLI when an option that requires a value is given with a NULL or empty value — typically `--test=` with nothing after the equals sign. The parser rejects it, prints usage, and exits with status 2.

Source

Thrown at src/collectors/network-viewer.plugin/network-viewer.c:7014

{
    for(int i = 1; i < argc; i++) {
        if(strcmp(argv[i], "--test") == 0 || strncmp(argv[i], "--test=", strlen("--test=")) == 0)
            return true;
    }

    return false;
}

static int network_viewer_set_required_option_once(const char **slot, const char *value, const char *option)
{
    if(*slot) {
        fprintf(stderr, "duplicate %s\n", option);
        network_viewer_test_usage(stderr);
        return 2;
    }

    if(!value || !*value) {
        fprintf(stderr, "missing value for %s\n", option);
        network_viewer_test_usage(stderr);
        return 2;
    }

    *slot = value;
    return 0;
}

static int network_viewer_set_timeout_option_once(uint64_t *slot, bool *slot_set, const char *value)
{
    if(*slot_set) {
        fprintf(stderr, "duplicate --timeout\n");
        network_viewer_test_usage(stderr);
        return 2;
    }

    if(!value || !*value) {
        fprintf(stderr, "missing value for --timeout\n");

View on GitHub (pinned to 4864de85e2)

Solutions

  1. Supply the function name: `--test=network-viewer`
  2. Default the variable first: `: "${FUNC:=network-viewer}"`

Example fix

# before
network-viewer.plugin --test=
# after
network-viewer.plugin --test=network-viewer
Defensive patterns

Strategy: validation

Validate before calling

case "$1" in --test=) echo 'empty --test value' >&2; exit 2;; esac
: "${FUNC:=network-viewer}"

Prevention

When it happens

Trigger: Passing `--test=`, or an option form where the value substring is missing/empty.

Common situations: Shell scripts interpolating an unset variable: `--test=${FUNC}` with FUNC empty; quoting errors that swallow the value.

Related errors


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