{
  "id": "java/class-format-error-constant-pool-tag",
  "signature": "java.lang.ClassFormatError: Constant pool tag 18 is invalid",
  "signature_zh": "java.lang.ClassFormatError：常量池标签 18 无效",
  "regex": "java\\.lang\\.ClassFormatError: Constant pool tag \\d+ is invalid",
  "domain": "java",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "This error occurs when the JVM attempts to load a class file with an invalid or unsupported constant pool tag, typically caused by a mismatch between the class file version and the JVM version or corruption of the class file.",
  "root_cause_type": "generic",
  "root_cause_zh": "当 JVM 尝试加载具有无效或不支持的常量池标签的类文件时发生此错误，通常由类文件版本与 JVM 版本不匹配或类文件损坏引起。",
  "versions": [
    {
      "version": "Java 8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Cleaning the project and rebuilding does not fix the underlying binary incompatibility or class corruption.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Recompiling with the same compiler version does not change the constant pool format; the issue is often from mixing class files from different Java versions.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is not related to JDK installation; reinstalling JDK does not fix class file corruption.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure all dependencies and the project are compiled with the same Java version. For Maven, set the maven-compiler-plugin source and target to match the runtime JVM.",
      "success_rate": 0.85,
      "how": "Ensure all dependencies and the project are compiled with the same Java version. For Maven, set the maven-compiler-plugin source and target to match the runtime JVM.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the error occurs from a third-party library, update the library to a version that matches your JVM, or exclude the problematic class and replace it with a newer version.",
      "success_rate": 0.75,
      "how": "If the error occurs from a third-party library, update the library to a version that matches your JVM, or exclude the problematic class and replace it with a newer version.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check the class file version using javap -verbose and ensure it is compatible with the JVM. Regenerate the class file if needed.",
      "success_rate": 0.7,
      "how": "Check the class file version using javap -verbose and ensure it is compatible with the JVM. Regenerate the class file if needed.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure all dependencies and the project are compiled with the same Java version. For Maven, set the maven-compiler-plugin source and target to match the runtime JVM.",
    "If the error occurs from a third-party library, update the library to a version that matches your JVM, or exclude the problematic class and replace it with a newer version.",
    "Check the class file version using javap -verbose and ensure it is compatible with the JVM. Regenerate the class file if needed."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ClassFormatError.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}