{
  "id": "tensorflow/custom-op-not-found",
  "signature": "tensorflow.python.framework.errors_impl.InternalError: OpKernel registration failed: Could not find 'CustomOp' in the list of registered ops.",
  "signature_zh": "内部错误：OpKernel 注册失败：在已注册的操作列表中找不到 'CustomOp'。",
  "regex": "InternalError: OpKernel registration failed: Could not find 'CustomOp'",
  "domain": "tensorflow",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "A custom TensorFlow operation was not properly compiled or loaded, so the runtime cannot find its kernel.",
  "root_cause_type": "generic",
  "root_cause_zh": "自定义 TensorFlow 操作未能正确编译或加载，导致运行时找不到其内核。",
  "versions": [
    {
      "version": "tensorflow>=2.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "tensorflow<=2.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use pip install tensorflow-custom-op",
      "why_fails": "Assumes a pip package exists; usually custom ops are not distributed via pip.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set PYTHONPATH to include the op source directory",
      "why_fails": "Does not compile the op; only adds source to path.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Compile the custom op using tf.load_op_library('path/to/custom_op.so') and ensure the .so file is in the same directory as the script.",
      "success_rate": 0.8,
      "how": "Compile the custom op using tf.load_op_library('path/to/custom_op.so') and ensure the .so file is in the same directory as the script.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use tf.raw_ops.CustomOp after ensuring the op is registered via a proper build script (e.g., using Bazel or CMake). Example: from tensorflow.python.framework import load_library; custom_op = load_library.load_op_library('custom_op.so')",
      "success_rate": 0.85,
      "how": "Use tf.raw_ops.CustomOp after ensuring the op is registered via a proper build script (e.g., using Bazel or CMake). Example: from tensorflow.python.framework import load_library; custom_op = load_library.load_op_library('custom_op.so')",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Compile the custom op using tf.load_op_library('path/to/custom_op.so') and ensure the .so file is in the same directory as the script.",
    "Use tf.raw_ops.CustomOp after ensuring the op is registered via a proper build script (e.g., using Bazel or CMake). Example: from tensorflow.python.framework import load_library; custom_op = load_library.load_op_library('custom_op.so')"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.tensorflow.org/guide/create_op",
  "official_doc_section": null,
  "error_code": "E006",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-05-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}