# ERROR: The line in requirements.txt has an invalid hash format: 'sha256:abc123...' The hash must be in the format 'sha256:...' (no spaces, lowercase).

- **ID:** `pip/requirements-hash-invalid-line`
- **Domain:** pip
- **Category:** data_error
- **Error Code:** `ERROR`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

A hash value in a requirements.txt file is malformed, e.g., contains uppercase letters, spaces, or incorrect algorithm prefix, causing pip to reject the entire line during hash verification.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pip 23.3 | active | — | — |
| pip 24.0 | active | — | — |
| pip 24.1 | active | — | — |

## Workarounds

1. **Regenerate the hash using pip's built-in tool: pip hash /path/to/package.whl** (95% success)
   ```
   Regenerate the hash using pip's built-in tool: pip hash /path/to/package.whl
   ```
2. **Manually correct the hash format in requirements.txt to lowercase and colon-separated: sha256:abcdef1234567890...** (90% success)
   ```
   Manually correct the hash format in requirements.txt to lowercase and colon-separated: sha256:abcdef1234567890...
   ```
3. **Use a hash generation script: python -c "import hashlib; print('sha256:' + hashlib.sha256(open('package.whl','rb').read()).hexdigest())"** (85% success)
   ```
   Use a hash generation script: python -c "import hashlib; print('sha256:' + hashlib.sha256(open('package.whl','rb').read()).hexdigest())"
   ```

## Dead Ends

- **** — Pip strictly parses the hash format; any deviation from 'algorithm:hexdigest' causes rejection. (50% fail)
- **** — Without the algorithm prefix, pip cannot determine which hash function to use for verification. (80% fail)
