Improve sanity_check_dependencies() (structured error handling)