# FAQs

## Common answer and mistake quickly solved

### ERR - Error the key is empty

You try to execute a command against a database like

```
REDISQL.EXEC DB-EXAMPLE "SELECT 1;"
```

and RediSQL returns the error: `ERR - Error the key is empty`.

Most likely the dabatase `DB-EXAMPLE` does not exists. To fix the problem you can simply create first the database with

```
REDISQL.CREATE_DB DB-EXAMPLE
```

During development is quite convenient to just delete everything from RediSQL, so it may happens that you encounter this error. A possible solution is to always invoke the `REDISQL.CREATE_DB` command, if the database is not there, it will be created, if the database is already there an error will be raise. As long as you are in a development environment just ignore the error.

### READONLY You can't write against a read only replica.

Redis and RediSQL supports **replication**. You can have the same database in different redis instance, on different processes and potentially on different machine. This means that you can read data from different instances in parallel, greatly improving reading performances. However you cannot write in parallel to different instances, otherwise we wouldn't know what data is "real". You can write only to the master instance.

By policy the `REDISQL.EXEC` command allow you to read and write and (due to Redis limitation) you cannot use this command on replicas. The `REDISQL.EXEC` command works only on the master node. This is true even if the query that you are trying to execute is an very simple read only query like `SELECT 1;`, you cannot `REDISQL.EXEC` against a replica node.

In order to read from the replicas, you can use the `REDISQL.QUERY` family of commands. This command is allowed to only read data, without modifying the database, hence you can use it also in the replica instances. Moreover it is a good idea to use it also against the master instance whenever is possible.

If you try to execute the `REDISQL.EXEC` command against a replica you will get the error `READONLY You can't write against a read only replica`. To query the replicas use the `REDISQL.QUERY` command.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.zeesql.com/faqs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
