Serialization security default

PyTorch add_safe_globals safe_globals full path module name weights_only

A current PyTorch task fails with: PyTorch `add_safe_globals` does not match checkpoint module path.

search-necessaryPyTorchPython ML serializationSerialization security defaultgitdocs_candidate100

Agent Quick Fix

The local workspace gives the symptom and stale integration shape, but the correct repair depends on current official product behavior or recent release notes.

Product: PyTorch
Current-contract area: PyTorch `add_safe_globals` does not match checkpoint module path
Likely root cause: A current PyTorch task fails with: PyTorch `add_safe_globals` does not match checkpoint module path. The local stale integration is plausible but may not reflect the current external contract.
Repair direction: Verifier accepts a repair record only if it states the current contract and an actionable fix using source-backed product terms.

Validation Status

Codex searched organically, passed with web access, and failed the no-web counterfactual under this fixture.

Symptom

A current PyTorch task fails with: PyTorch `add_safe_globals` does not match checkpoint module path. The local stale integration is plausible but may not reflect the current external contract.

Why This Happens

The local workspace gives the symptom and stale integration shape, but the correct repair depends on current official product behavior or recent release notes.

Verification

Verifier accepts a repair record only if it states the current contract and an actionable fix using source-backed product terms.

Common Wrong Fixes

  • Changing local code without checking the current external contract.
  • Retrying the same install, build, or API call with no version/source change.
  • Applying a broad unsafe bypass when a narrow compatibility fix is available.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

site:pytorch.org/docs add_safe_globals module path safe globals torch.load weights_only
PyTorch add_safe_globals safe_globals full path module name weights_only
https://pytorch.org/docs/stable/notes/serialization.html
https://docs.pytorch.org/docs/stable/notes/serialization.html
docs.pytorch.org torch.serialization.add_safe_globals
https://docs.pytorch.org/docs/2.12/notes/serialization.html
'add_safe_globals' in https://docs.pytorch.org/docs/2.12/notes/serialization.html
https://docs.pytorch.org/docs/2.12/generated/torch.serialization.add_safe_globals.html
site:docs.pytorch.org/docs/2.12/generated/torch.serialization.add_safe_globals.html add_safe_globals

Source Trail