{
  "id": "mongodb/plan-cache-invalidation-failed",
  "signature": "MongoServerError: PlanCache invalidated entry for query shape but could not re-plan: internal error",
  "signature_zh": "MongoServerError：查询形状的计划缓存条目已失效但无法重新规划：内部错误",
  "regex": "PlanCache invalidated entry for query shape but could not re-plan",
  "domain": "mongodb",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The plan cache entry for a query shape was invalidated due to index changes or data distribution shifts, but the query planner failed to generate a new plan due to corrupted cache metadata or missing index.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于索引更改或数据分布变化，查询形状的计划缓存条目失效，但查询规划器因缓存元数据损坏或索引缺失而无法生成新计划。",
  "versions": [],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Restarting mongod clears the plan cache temporarily, but the error reoccurs if the underlying cause (e.g., missing index or stale statistics) isn't addressed.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Manually running db.collection.getPlanCache().clear() may not help if the query shape is still cached in the server's internal structures; the error persists.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Run db.collection.getPlanCache().clear() followed by db.collection.createIndex() for the missing index, then re-execute the query to force a fresh plan.",
      "success_rate": 0.85,
      "how": "Run db.collection.getPlanCache().clear() followed by db.collection.createIndex() for the missing index, then re-execute the query to force a fresh plan.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Upgrade to MongoDB 7.0+ where plan cache invalidation is more robust; if not possible, set internalQueryPlanCacheSize to 0 in the configuration to disable caching temporarily.",
      "success_rate": 0.8,
      "how": "Upgrade to MongoDB 7.0+ where plan cache invalidation is more robust; if not possible, set internalQueryPlanCacheSize to 0 in the configuration to disable caching temporarily.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Run db.collection.getPlanCache().clear() followed by db.collection.createIndex() for the missing index, then re-execute the query to force a fresh plan.",
    "Upgrade to MongoDB 7.0+ where plan cache invalidation is more robust; if not possible, set internalQueryPlanCacheSize to 0 in the configuration to disable caching temporarily."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.mongodb.com/docs/manual/reference/command/planCacheClear/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}