redis/redis · info
./redis-server -h or --help\n
Error message
./redis-server -h or --help\n
What it means
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.
Source
Thrown at src/server.c:7291
}
sds getVersion(void) {
sds version = sdscatprintf(sdsempty(),
"v=%s sha=%s:%d malloc=%s bits=%d build=%llx",
REDIS_VERSION,
redisGitSHA1(),
atoi(redisGitDirty()) > 0,
ZMALLOC_LIB,
sizeof(long) == 4 ? 32 : 64,
(unsigned long long) redisBuildId());
return version;
}
void usage(void) {
fprintf(stderr,"Usage: ./redis-server [/path/to/redis.conf] [options] [-]\n");
fprintf(stderr," ./redis-server - (read config from stdin)\n");
fprintf(stderr," ./redis-server -v or --version\n");
fprintf(stderr," ./redis-server -h or --help\n");
fprintf(stderr," ./redis-server --test-memory <megabytes>\n");
fprintf(stderr," ./redis-server --check-system\n");
fprintf(stderr,"\n");
fprintf(stderr,"Examples:\n");
fprintf(stderr," ./redis-server (run the server with default conf)\n");
fprintf(stderr," echo 'maxmemory 128mb' | ./redis-server -\n");
fprintf(stderr," ./redis-server /etc/redis/6379.conf\n");
fprintf(stderr," ./redis-server --port 7777\n");
fprintf(stderr," ./redis-server --port 7777 --replicaof 127.0.0.1 8888\n");
fprintf(stderr," ./redis-server /etc/myredis.conf --loglevel verbose -\n");
fprintf(stderr," ./redis-server /etc/myredis.conf --loglevel verbose\n\n");
fprintf(stderr,"Sentinel mode:\n");
fprintf(stderr," ./redis-server /etc/sentinel.conf --sentinel\n");
exit(1);
}
void redisAsciiArt(void) {
#include "asciilogo.h"View on GitHub (pinned to 4f20cb4893)
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.
Example fix
# before set -e ./redis-server --help # exits 1, aborts script # after ./redis-server --help || true
Defensive patterns
Strategy: validation
Validate before calling
# separate help requests from strict error handling set +e ./redis-server --help > help.txt 2>&1 rc=$? set -e [ $rc -eq 1 ] && echo "help shown (expected exit 1)"
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ./redis-server -v or --version\n
- ./redis-server --test-memory <megabytes>\n
- ./redis-server --check-system\n
- Examples:\n
- ./redis-server (run the server with default conf)\n
AI-assisted analysis of redis/redis@4f20cb4893 (2026-08-10).
Data as JSON: /api/errors/f61ae101ebb21f9b.
Report an issue: GitHub.