Fixing Redis Error: (error) ERR The server is running without a config file during CONFIG REWRITE

intermediate๐Ÿ”ด Redis2026-07-20| Redis (all versions), Linux (Ubuntu/CentOS/Debian), Docker containers

Error Message

(error) ERR The server is running without a config file
#redis#config#config-rewrite#administration#persistence

The Problem ContextWhile managing a Redis instance, it is common to change configurations on the fly using the CONFIG SET command. For example, you might increase the maxmemory or change the appendonly status without wanting to restart the service. To make these changes permanent, the standard practice is to run:

127.0.0.1:6379> CONFIG REWRITE

However, you might encounter this specific error message:

(error) ERR The server is running without a config file

This happens because Redis was started as a bare process without a pointer to a physical redis.conf file. If Redis doesn't know where its configuration file lives, it cannot rewrite it to save your changes.

Why this error occursRedis can start in two ways. The first is by specifying a configuration file path as an argument. The second is by running the binary alone, which causes Redis to use built-in default values. If you use the latter method, Redis operates entirely in memory regarding its configuration. When you trigger CONFIG REWRITE, the engine looks for the file path it was initialized with. Finding none, it throws the error because there is no target file to update.

Common scenarios leading to this:

  • Starting the server manually via redis-server instead of redis-server /path/to/redis.conf.- Docker containers where the command is just redis-server and the config isn't mapped or specified.- Systemd unit files that are missing the configuration file argument in the ExecStart directive.## Debugging the SetupBefore applying a fix, confirm how your Redis process was started. On a Linux system, use ps to inspect the running process:
ps aux | grep redis-server

If the output looks like this, you have confirmed the issue:

redis     1234  0.1  0.5 150000 10000 ?        Ssl  10:00   0:01 /usr/bin/redis-server *:6379

Notice that there is no file path after the port. A correctly configured instance should look like this:

redis     1234  0.1  0.5 150000 10000 ?        Ssl  10:00   0:01 /usr/bin/redis-server /etc/redis/redis.conf

The Solution### Method 1: Restarting with a Config File (Recommended)The most robust fix is to ensure Redis starts with a configuration file. If you don't have one, you can download the default redis.conf for your version from the official Redis GitHub repository.

  • Create or locate your config file (usually at /etc/redis/redis.conf).- Stop the current Redis instance: redis-cli shutdown- Start Redis while explicitly pointing to the config file: redis-server /etc/redis/redis.confIf you are using Systemd, check your service file at /etc/systemd/system/redis.service or /lib/systemd/system/redis.service. Ensure the ExecStart line includes the path:
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf

Method 2: Fixing Docker EnvironmentsIn Docker, this error often occurs because the container starts with the default entrypoint. To fix this, you must mount a local config file into the container and tell Redis to use it in the docker-compose.yml or docker run command.

Example docker-compose.yml snippet:

services:
  redis:
    image: redis:latest
    volumes:
      - ./redis.conf:/usr/local/etc/redis/redis.conf
    command: ["redis-server", "/usr/local/etc/redis/redis.conf"]

Method 3: The "No-Restart" WorkaroundIf you cannot afford downtime to restart Redis but desperately need to save your current runtime configuration, you can manually create a file from the current state. This is a bit of a hack but works in emergencies.

  • Connect to Redis and get all current configs: redis-cli CONFIG GET * > current_config.txt- This output isn't in the redis.conf format (it's key-value pairs on new lines). You'll need to reformat it manually or via a script into key value format.- Once you've created a valid redis.conf, you must still restart Redis with that file to enable CONFIG REWRITE for future use. There is no way to "attach" a config file to a running Redis process without a restart.## VerificationOnce you have restarted Redis with the configuration file path, verify that the fix works:
  • Connect via redis-cli.- Change a dummy parameter: 127.0.0.1:6379> CONFIG SET loglevel notice- Execute the rewrite: 127.0.0.1:6379> CONFIG REWRITEIf it returns OK, the fix is successful. You can also check the timestamp of your redis.conf file on the filesystem; it should reflect the time you ran the command.

Lessons Learned- Always use a config file: Even if you intend to use default settings, start Redis with a file. It acts as a placeholder for future CONFIG REWRITE operations.- Check Process Arguments: When troubleshooting Redis, the first step should always be checking the ps aux output to see exactly how the binary was invoked.- Automation: If using configuration management (Ansible, Chef, etc.), ensure your templates always deploy a redis.conf and that your service manager points to it explicitly.

Related Error Notes