The server is running without a config file
Production Risk
Low, but it can lead to confusion and perceived data loss if configuration changes are not persisted correctly.
This error occurs when the `CONFIG REWRITE` command is issued, but the Redis server was started without a configuration file. Redis does not know where to write the configuration, so the command fails.
- 1Starting `redis-server` with no arguments.
- 2Explicitly providing `/dev/null` as the config file.
- 3Running Redis in an environment (like a container) that starts it without a config file path.
An admin connects to a Redis instance that was started with `redis-server` and tries to persist a configuration change.
CONFIG SET maxmemory 1GB CONFIG REWRITE
expected output
(error) ERR The server is running without a config file.
Fix 1
Restart the Redis server with a configuration file path
WHEN To enable persistent configuration changes
redis-server /etc/redis/redis.conf
Why this works
By providing a path to a config file on startup, Redis knows where to write changes when `CONFIG REWRITE` is called. The file must be writable by the Redis user.
Fix 2
Apply configuration changes manually
WHEN `CONFIG REWRITE` is not an option
# 1. Apply dynamically CONFIG SET maxmemory 1GB # 2. Manually add to your deployment scripts/config file # maxmemory 1GB
Why this works
If you cannot restart the server with a file, you must treat dynamic `CONFIG SET` changes as temporary and ensure the same settings are applied in your permanent configuration for the next time Redis starts.
✕ Assume `CONFIG SET` is persistent
Unless `CONFIG REWRITE` is called successfully, any changes made by `CONFIG SET` will be lost the next time the server restarts.
Server startup and configuration handling.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev