{"record":{"id":"263badba3e9e55e7","repo":"netdata/netdata","slug":"invalid-value-for-timeout-s-expected-seconds-263bad","errorCode":null,"errorMessage":"invalid value for --timeout '%s'; expected seconds\n","messagePattern":"invalid value for --timeout '(.+?)'; expected seconds\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/collectors/network-viewer.plugin/network-viewer.c","lineNumber":7039,"sourceCode":"}\n\nstatic int network_viewer_set_timeout_option_once(uint64_t *slot, bool *slot_set, const char *value)\n{\n    if(*slot_set) {\n        fprintf(stderr, \"duplicate --timeout\\n\");\n        network_viewer_test_usage(stderr);\n        return 2;\n    }\n\n    if(!value || !*value) {\n        fprintf(stderr, \"missing value for --timeout\\n\");\n        network_viewer_test_usage(stderr);\n        return 2;\n    }\n\n    for(const char *s = value; *s; s++) {\n        if(*s < '0' || *s > '9') {\n            fprintf(stderr, \"invalid value for --timeout '%s'; expected seconds\\n\", value);\n            network_viewer_test_usage(stderr);\n            return 2;\n        }\n    }\n\n    errno = 0;\n    unsigned long long parsed = strtoull(value, NULL, 10);\n    if(errno == ERANGE) {\n        fprintf(stderr, \"invalid value for --timeout '%s'; expected seconds\\n\", value);\n        network_viewer_test_usage(stderr);\n        return 2;\n    }\n\n#if ULLONG_MAX > UINT64_MAX\n    if(parsed > UINT64_MAX) {\n        fprintf(stderr, \"invalid value for --timeout '%s'; expected seconds\\n\", value);\n        network_viewer_test_usage(stderr);\n        return 2;","sourceCodeStart":7021,"sourceCodeEnd":7057,"githubUrl":"https://github.com/netdata/netdata/blob/4864de85e26f6734d92cfc27ccbeff5921f49938/src/collectors/network-viewer.plugin/network-viewer.c#L7021-L7057","documentation":"First --timeout validation failure in the network-viewer.plugin test CLI: the value contains a character outside ASCII '0'-'9' — a sign, decimal point, unit suffix, or whitespace. Exit status 2 with usage.","triggerScenarios":"Passing `--timeout=10s`, `--timeout=0.5`, `--timeout=-1`, or a value with an embedded space.","commonSituations":"Reusing durations written in netdata.conf unit syntax ('10s', '1m') where this CLI accepts bare integer seconds only.","solutions":["Use an integer seconds value: `--timeout=10`","Convert unit strings to plain seconds in the calling script before passing them"],"exampleFix":"# before\nnetwork-viewer.plugin --test=network-viewer --timeout=10s\n# after\nnetwork-viewer.plugin --test=network-viewer --timeout=10","handlingStrategy":"validation","validationCode":"is_uint() { case \"$1\" in ''|*[!0-9]*) return 1;; *) return 0;; esac; }\nis_uint \"$TIMEOUT\" || { echo \"timeout must be plain integer seconds\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass unit-suffixed durations ('10s') — this CLI wants bare seconds","Strip units/convert to seconds in the calling script before building the command"],"tags":["network-viewer","cli","argument-parsing","timeout","invalid-value"],"backgroundTag":null,"analyzedSha":"4864de85e26f6734d92cfc27ccbeff5921f49938","analyzedAt":"2026-08-15T09:12:38.226Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}