{"record":{"id":"5b3297ed1eb89c54","repo":"jax-ml/jax","slug":"self-class-name-has-no-attribute-name","errorCode":null,"errorMessage":"{self.__class__.__name__} has no attribute {name}","messagePattern":"(.+?) has no attribute (.+?)","errorType":"error_code","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"jax/_src/ad_util.py","lineNumber":123,"sourceCode":"stop_gradient_p.def_abstract_eval(lambda x: x)\n\n\n# User-facing version of `Zero`\nclass SymbolicZero:\n  def __init__(self, aval: core.AbstractValue) -> None:\n    self.aval = aval\n\n  def __repr__(self) -> str:\n    return self.__class__.__name__\n\n  # TODO(mattjj,frostig): this forwards attr lookup to self.aval delegate;\n  # should dedup with core.Tracer.__getattr__ which does the same thing\n  def __getattr__(self, name):\n    # if the aval property raises an AttributeError, gets caught here\n    try:\n      attr = getattr(self.aval, name)\n    except KeyError as err:\n      raise AttributeError(\n          f\"{self.__class__.__name__} has no attribute {name}\"\n      ) from err\n    else:\n      t = type(attr)\n      if t is core.aval_property:\n        return attr.fget(self)\n      elif t is core.aval_method:\n        return types.MethodType(attr.fun, self)\n      else:\n        return attr\n\n  @staticmethod\n  def from_primal_value(val: Any) -> SymbolicZero:\n    return SymbolicZero(typeof(val).to_tangent_aval())\n\ndef zero_from_primal(val, symbolic_zeros=False):\n  def f(x):\n    t_aval = typeof(x).to_tangent_aval()","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/ad_util.py#L105-L141","documentation":"FromPickle found a non-None node_data (t[2]) for a node kind that should carry no node data (leaf, tuple, list, etc.). The pickle's node encoding is inconsistent with the expected format.","triggerScenarios":"Unpickling a PyTreeDef where a non-custom node tuple has a non-None third element, typically from malformed or version-skewed pickles.","commonSituations":"Cross-version unpickling of saved treedefs; corrupted checkpoint files; third-party code that synthesizes pickled treedefs incorrectly.","solutions":["Regenerate the treedef from actual Python objects instead of unpickling","Re-serialize with the matching jaxlib version","Validate pickle provenance (jaxlib version) before loading"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    treedef = pickle.loads(data)\nexcept Exception as e:\n    if 'Malformed pickled PyTreeDef' in str(e):\n        _, treedef = jax.tree_util.tree_flatten(reference)\n    else:\n        raise","preventionTips":["Pin jaxlib versions between save and load","Avoid editing pickled payloads","Prefer re-deriving treedefs from Python objects"],"tags":["pytree","jax","pickle","malformed-data"],"backgroundTag":"pytree-pickle-corruption","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}