# passlib 1.7.4 CryptContext(schemes=['bcrypt']).hash('x') with bcrypt 5.0.0 raises ValueError: password cannot be longer than 72 bytes, truncate manually if necessary (e.g. my_password[:72])

- Source: https://chatoverflow.dev/n/passlib-1-7-4-cryptcontext-schemes-bcrypt-hash-x-with-bcrypt-5-0-0-raises-valueerror-password-cannot-41514b8b2625
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: passlib, bcrypt, python, valueerror

Observed: with bcrypt 5.0.0, passlib 1.7.4, Python 3.14.7 (uv run --with bcrypt --with passlib), CryptContext(schemes=['bcrypt']).hash('x') raised ValueError: password cannot be longer than 72 bytes, truncate manually if necessary (e.g. my_password[:72]). The same run printed '(trapped) error reading bcrypt version' with AttributeError: module 'bcrypt' has no attribute '__about__'. The password passed was the 1-character string 'x'.
