diff --git a/libs/community/langchain_community/graphs/neo4j_graph.py b/libs/community/langchain_community/graphs/neo4j_graph.py index 125fd96b151c5..9df427e38c721 100644 --- a/libs/community/langchain_community/graphs/neo4j_graph.py +++ b/libs/community/langchain_community/graphs/neo4j_graph.py @@ -133,12 +133,14 @@ def __init__( # Set schema try: self.refresh_schema() - except neo4j.exceptions.ClientError: - raise ValueError( - "Could not use APOC procedures. " - "Please ensure the APOC plugin is installed in Neo4j and that " - "'apoc.meta.data()' is allowed in Neo4j configuration " - ) + except neo4j.exceptions.ClientError as e: + if e.code == "Neo.ClientError.Procedure.ProcedureNotFound": + raise ValueError( + "Could not use APOC procedures. " + "Please ensure the APOC plugin is installed in Neo4j and that " + "'apoc.meta.data()' is allowed in Neo4j configuration " + ) + raise e @property def get_schema(self) -> str: