{"record":{"id":"e4d853678d833254","repo":"jax-ml/jax","slug":"serializing-disabledsafetycheck-check","errorCode":null,"errorMessage":"serializing DisabledSafetyCheck: {check}","messagePattern":"serializing DisabledSafetyCheck: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/export/serialization.py","lineNumber":919,"sourceCode":"        )\n\n  raise NotImplementedError(\n      f\"cannot deserialize effect type {effect_type_name}\"\n  )\n\n\ndef _serialize_disabled_safety_check(\n    builder: flatbuffers.Builder, check: _export.DisabledSafetyCheck\n) -> int:\n  custom_call_target_str = check.is_custom_call()\n  custom_call_target = None\n  if custom_call_target_str is not None:\n    kind = ser_flatbuf.DisabledSafetyCheckKind.custom_call\n    custom_call_target = builder.CreateString(custom_call_target_str)\n  elif check == _export.DisabledSafetyCheck.platform():\n    kind = ser_flatbuf.DisabledSafetyCheckKind.platform\n  else:\n    raise NotImplementedError(f\"serializing DisabledSafetyCheck: {check}\")\n\n  ser_flatbuf.DisabledSafetyCheckStart(builder)\n  ser_flatbuf.DisabledSafetyCheckAddKind(builder, kind)\n  if custom_call_target is not None:\n    ser_flatbuf.DisabledSafetyCheckAddCustomCallTarget(\n        builder, custom_call_target\n    )\n  return ser_flatbuf.DisabledSafetyCheckEnd(builder)\n\n\ndef _deserialize_disabled_safety_check(\n    sc: ser_flatbuf.DisabledSafetyCheck,\n) -> _export.DisabledSafetyCheck:\n  kind = sc.Kind()\n  if kind == ser_flatbuf.DisabledSafetyCheckKind.custom_call:\n    return _export.DisabledSafetyCheck.custom_call(\n        sc.CustomCallTarget().decode(\"utf-8\")\n    )","sourceCodeStart":901,"sourceCodeEnd":937,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/export/serialization.py#L901-L937","documentation":"JAX's export serialization writes each disabled safety check into a flatbuffer; only two kinds are supported: per-custom-call-target checks and the platform-wide check. If a DisabledSafetyCheck object is neither of those (e.g. a future or custom subclass), the serializer raises NotImplementedError.","triggerScenarios":"Calling jax.export.save with an ExportedModules bundle whose disabled_checks contain a DisabledSafetyCheck that has no custom_call_target_str and is not DisabledSafetyCheck.platform() (e.g. a user-defined subclass or manually crafted object).","commonSituations":"Version mismatch: an ExportedModules object created or monkey-patched with a newer/older JAX that has additional check kinds; constructing DisabledSafetyCheck via internal APIs instead of export_disabled_checks(context=...) or platform=True.","solutions":["Create disabled checks only via the public API: jax.export.export(..., export_platforms=...) or export_disabled_checks with a known custom call target or platform=True","If subclassing DisabledSafetyCheck, serialize it as custom_call by setting the custom call target name instead","Match JAX versions between the process that created the export and the one serializing it"],"exampleFix":"// before\nclass MyCheck(jax.export.DisabledSafetyCheck): ...\nchecks = [MyCheck()]\n// after\nchecks = [jax.export.DisabledSafetyCheck.custom_call('my_custom_target')]\n// or the platform check\nchecks = [jax.export.DisabledSafetyCheck.platform()]","handlingStrategy":"validation","validationCode":"from jax._src import export as _export\nok = all(c.custom_call_target is not None or c == _export.DisabledSafetyCheck.platform() for c in checks)","typeGuard":"def is_serializable_check(c) -> bool:\n    return getattr(c, 'custom_call_target', None) is not None or c == jax.export.DisabledSafetyCheck.platform()","tryCatchPattern":"try:\n    jax.export.save(path, exported)\nexcept NotImplementedError as e:\n    if 'DisabledSafetyCheck' in str(e): drop_or_replace_offending_checks()","preventionTips":["Only build disabled checks via public APIs (custom call target strings or platform)","Pin jax versions across the pipeline that creates and serializes exports"],"tags":["jax","export","serialization","flatbuffers"],"backgroundTag":"unsupported-serialization-type","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}