{"record":{"id":"f61ae101ebb21f9b","repo":"redis/redis","slug":"redis-server-h-or-help-n","errorCode":null,"errorMessage":"       ./redis-server -h or --help\\n","messagePattern":"       \\./redis-server -h or --help\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/server.c","lineNumber":7291,"sourceCode":"}\n\nsds getVersion(void) {\n    sds version = sdscatprintf(sdsempty(),\n        \"v=%s sha=%s:%d malloc=%s bits=%d build=%llx\",\n        REDIS_VERSION,\n        redisGitSHA1(),\n        atoi(redisGitDirty()) > 0,\n        ZMALLOC_LIB,\n        sizeof(long) == 4 ? 32 : 64,\n        (unsigned long long) redisBuildId());\n    return version;\n}\n\nvoid usage(void) {\n    fprintf(stderr,\"Usage: ./redis-server [/path/to/redis.conf] [options] [-]\\n\");\n    fprintf(stderr,\"       ./redis-server - (read config from stdin)\\n\");\n    fprintf(stderr,\"       ./redis-server -v or --version\\n\");\n    fprintf(stderr,\"       ./redis-server -h or --help\\n\");\n    fprintf(stderr,\"       ./redis-server --test-memory <megabytes>\\n\");\n    fprintf(stderr,\"       ./redis-server --check-system\\n\");\n    fprintf(stderr,\"\\n\");\n    fprintf(stderr,\"Examples:\\n\");\n    fprintf(stderr,\"       ./redis-server (run the server with default conf)\\n\");\n    fprintf(stderr,\"       echo 'maxmemory 128mb' | ./redis-server -\\n\");\n    fprintf(stderr,\"       ./redis-server /etc/redis/6379.conf\\n\");\n    fprintf(stderr,\"       ./redis-server --port 7777\\n\");\n    fprintf(stderr,\"       ./redis-server --port 7777 --replicaof 127.0.0.1 8888\\n\");\n    fprintf(stderr,\"       ./redis-server /etc/myredis.conf --loglevel verbose -\\n\");\n    fprintf(stderr,\"       ./redis-server /etc/myredis.conf --loglevel verbose\\n\\n\");\n    fprintf(stderr,\"Sentinel mode:\\n\");\n    fprintf(stderr,\"       ./redis-server /etc/sentinel.conf --sentinel\\n\");\n    exit(1);\n}\n\nvoid redisAsciiArt(void) {\n#include \"asciilogo.h\"","sourceCodeStart":7273,"sourceCodeEnd":7309,"githubUrl":"https://github.com/redis/redis/blob/4f20cb48934463db5970bd476461b2d57af3f38d/src/server.c#L7273-L7309","documentation":"Usage-banner line printed by usage() at src/server.c:7291, documenting the `-h` / `--help` flag itself. It is emitted to stderr alongside the rest of the banner when the user requests help (src/server.c:8178-8179), followed by exit(1). Like the other banner lines it is instructional text, not an exception.","triggerScenarios":"Triggered by `redis-server -h` or `redis-server --help`. The strcmp checks at src/server.c:8178 route to usage(), which prints the full banner (lines 7288-7304) and then calls exit(1) at line 7305.","commonSituations":"New operators discovering the server's CLI surface; packaging scripts that call `--help` during postinst to verify the binary is present; CI sanity checks. The non-zero exit can trip strict pipelines.","solutions":["Run `./redis-server -h` or `./redis-server --help` deliberately to view all options; expect exit code 1.","In automation, separate the help invocation from `set -e` / `set -o pipefail` pipelines, or capture `|| true`.","Cache the help output in docs rather than regenerating it in a fail-on-nonzero context."],"exampleFix":"# before\nset -e\n./redis-server --help   # exits 1, aborts script\n# after\n./redis-server --help || true","handlingStrategy":"validation","validationCode":"# separate help requests from strict error handling\nset +e\n./redis-server --help > help.txt 2>&1\nrc=$?\nset -e\n[ $rc -eq 1 ] && echo \"help shown (expected exit 1)\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap --help invocations so exit code 1 does not abort scripts.","Cache help output rather than regenerating it inside fail-on-error pipelines.","Document the exit-code-1 quirk for operators onboarding to Redis."],"tags":["redis","cli","usage","help-text","server"],"backgroundTag":null,"analyzedSha":"4f20cb48934463db5970bd476461b2d57af3f38d","analyzedAt":"2026-08-10T14:17:07.821Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}