def _log_dag_errors(self, nodes, edges):
        """Log diagnostic information for DAG creation errors."""
        from airweave.core.logging import logger

        logger.error(f"Total nodes: {len(nodes)}, Total edges: {len(edges)}")

        # Check for any duplicate node IDs which could cause issues
        node_ids = [node.id for node in nodes]
        duplicate_ids = {id: count for id, count in Counter(node_ids).items() if count > 1}
        if duplicate_ids:
            logger.error(f"Found duplicate node IDs: {duplicate_ids}")

        # Log edge relationships to verify they point to valid nodes
        edge_relationships = [(edge.from_node_id, edge.to_node_id) for edge in edges]

        # Check for edges referencing non-existent nodes
        node_id_set = set(node_ids)
        invalid_edges = []
        for from_id, to_id in edge_relationships:
            if from_id not in node_id_set:
                invalid_edges.append(f"Edge from_node_id {from_id} not in nodes")
            if to_id not in node_id_set:
                invalid_edges.append(f"Edge to_node_id {to_id} not in nodes")

        if invalid_edges:
            logger.error(f"Found invalid edges: {invalid_edges}")
Log diagnostic information for DAG creation errors.
backend/airweave/core/dag_service.py