# PyTorch torch.load weights_only default 2.6 unsafe arbitrary code execution

Status: search-observed
Product: PyTorch
Last verified: 2026-06-25
Canonical HTML: https://gitdocs.org/fix/why-weights-only-false-is-unsafe-for-user-uploaded-checkpoints
Machine JSON: https://gitdocs.org/api/fixes/why-weights-only-false-is-unsafe-for-user-uploaded-checkpoints.json

## Exact Symptom

See the observed Codex queries below.

## Diagnosis

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

## Fix

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

## Avoid

- 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.

## Observed Codex Queries

- site:pytorch.org docs torch.load weights_only False unsafe user uploaded checkpoints default changed 2.6
- PyTorch torch.load weights_only default 2.6 unsafe arbitrary code execution
- https://pytorch.org/docs/stable/generated/torch.load.html
- https://docs.pytorch.org/docs/stable/generated/torch.load.html
- 'torch.load(' in https://docs.pytorch.org/docs/2.12/generated/torch.load.html
- https://docs.pytorch.org/docs/2.12/generated/torch.load.html
- https://docs.pytorch.org/docs/2.12/notes/serialization.html
- site:pytorch.org/blog PyTorch 2.6 weights_only torch.load default

## Sources

- PyTorch serialization notes: https://docs.pytorch.org/docs/stable/notes/serialization.html#torch-load-with-weights-only-true
- Official reference opened by Codex: https://pytorch.org/docs/stable/generated/torch.load.html
- Official reference opened by Codex: https://docs.pytorch.org/docs/stable/generated/torch.load.html
- Official reference opened by Codex: https://docs.pytorch.org/docs/2.12/generated/torch.load.html
- Official reference opened by Codex: https://docs.pytorch.org/docs/2.12/notes/serialization.html
