# ERR RedisGraph: Graph 'mygraph' does not exist. Use GRAPH.CREATE first.

- **ID:** `redis/redisgraph-module-error`
- **Domain:** redis
- **Category:** module_error
- **Error Code:** `ERR`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Attempting to run GRAPH.QUERY on a non-existent graph key without prior GRAPH.CREATE call.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.2.0 | active | — | — |
| 7.4.0 | active | — | — |
| 8.0.0 | active | — | — |

## Workarounds

1. **Create the graph first: GRAPH.CREATE mygraph. Then retry GRAPH.QUERY mygraph 'MATCH (n) RETURN n'.** (95% success)
   ```
   Create the graph first: GRAPH.CREATE mygraph. Then retry GRAPH.QUERY mygraph 'MATCH (n) RETURN n'.
   ```
2. **If using RedisGraph v2.12+, enable auto-create: CONFIG SET graph.auto_create 1. Then GRAPH.QUERY will auto-create the graph.** (85% success)
   ```
   If using RedisGraph v2.12+, enable auto-create: CONFIG SET graph.auto_create 1. Then GRAPH.QUERY will auto-create the graph.
   ```

## Dead Ends

- **** — Using GRAPH.QUERY with a non-existent graph name will auto-create it in some versions, but not in strict mode; this behavior is version-dependent and unreliable. (50% fail)
- **** — Renaming the graph key with RENAME will fail if the key doesn't exist; it doesn't solve the missing graph issue. (80% fail)
