ERR redis module_error ai_generated true

RedisGraph:图 'mygraph' 不存在。请先使用 GRAPH.CREATE。

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

ID: redis/redisgraph-module-error

其他格式: JSON · Markdown 中文 · English
92%修复率
88%置信度
1证据数
2024-02-10首次发现

版本兼容性

版本状态引入弃用备注
7.2.0 active
7.4.0 active
8.0.0 active

根因分析

尝试对不存在的图键执行 GRAPH.QUERY,而未先调用 GRAPH.CREATE。

English

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

generic

官方文档

https://redis.io/docs/stack/graph/

解决方案

  1. 先创建图:GRAPH.CREATE mygraph。然后重试 GRAPH.QUERY mygraph 'MATCH (n) RETURN n'。
  2. 如果使用 RedisGraph v2.12+,启用自动创建:CONFIG SET graph.auto_create 1。然后 GRAPH.QUERY 将自动创建图。

无效尝试

常见但无效的做法:

  1. 50% 失败

    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.

  2. 80% 失败

    Renaming the graph key with RENAME will fail if the key doesn't exist; it doesn't solve the missing graph issue.