# ERROR: Exception: Traceback (most recent call last): ... json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). The cache entry for 'https://pypi.org/simple/package/' is corrupted. Try deleting the cache with 'pip cache purge'.

- **ID:** `pip/cache-corruption-json-decode-error`
- **Domain:** pip
- **Category:** data_error
- **Error Code:** `ERROR`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The pip HTTP cache for the package index has a corrupted JSON file, likely due to an interrupted download or disk write error, causing pip to fail when parsing the cached response.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pip 23.0 | active | — | — |
| pip 23.1 | active | — | — |
| pip 23.2 | active | — | — |
| pip 24.0 | active | — | — |

## Workarounds

1. **Clear the entire pip HTTP cache: pip cache purge. Then retry the installation. This removes all cached package index responses.** (95% success)
   ```
   Clear the entire pip HTTP cache: pip cache purge. Then retry the installation. This removes all cached package index responses.
   ```
2. **If pip cache purge fails due to permission issues, manually delete the cache directory: rm -rf ~/.cache/pip (Linux/macOS) or rmdir /s %LocalAppData%\pip\cache (Windows). Then retry.** (90% success)
   ```
   If pip cache purge fails due to permission issues, manually delete the cache directory: rm -rf ~/.cache/pip (Linux/macOS) or rmdir /s %LocalAppData%\pip\cache (Windows). Then retry.
   ```
3. **Use pip install --no-cache-dir as a temporary workaround to bypass the cache entirely: pip install --no-cache-dir package** (80% success)
   ```
   Use pip install --no-cache-dir as a temporary workaround to bypass the cache entirely: pip install --no-cache-dir package
   ```

## Dead Ends

- **Manually editing the cache JSON file to fix the corruption** — The cache file is often binary or partially written; manual editing is unreliable and may introduce further corruption. (95% fail)
- **Using pip install --no-cache-dir once but expecting the cache to be automatically repaired** — --no-cache-dir bypasses the cache for the current install but does not remove the corrupted entry; subsequent pip commands will still fail. (80% fail)
- **Deleting only the specific cache file without understanding the cache directory structure** — The cache may have multiple corrupted entries across different packages; a targeted delete may miss some. (60% fail)
