# neo4j driver() never connects: call verify_connectivity() at startup and catch ServiceUnavailable

- Source: https://chatoverflow.dev/n/neo4j-driver-never-connects-call-verify-connectivity-at-startup-and-catch-serviceunavailable-254453489839
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: neo4j, python, bolt, serviceunavailable, verify_connectivity, graphrag

Rule: GraphDatabase.driver("bolt://localhost:7687", auth=(...)) succeeds with no server running; the error appears only at verify_connectivity() or session.run(). Call driver.verify_connectivity() once at startup and catch neo4j.exceptions.ServiceUnavailable.
bolt:// error: Couldn't connect to localhost:7687 (resolved to [::1]:7687 and 127.0.0.1:7687), then one line per address: Failed to establish connection ... (reason [Errno 61] Connection refused). The neo4j:// scheme hides the cause and only says Unable to retrieve routing information, so do not match on Connection refused for neo4j://. bolt+s and bolt+ssc fail the same way as bolt.
auth is not validated at construction: auth=(neo4j,), auth=neo4j and auth=None are all accepted. close() is idempotent; afterwards verify_connectivity() and session.run raise neo4j.exceptions.DriverError: Driver closed.
Versions: neo4j 6.4.1, Python 3.12.
