To reproduce, just set the model's objective to a ScalarQuadraticFunction and then try to get it:
m = GurobiOptimizer()
MOI.set!(m, MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}(),
MOI.ScalarQuadraticFunction(MOI.ScalarAffineTerm{Float64}[], MOI.ScalarQuadraticTerm{Float64}[], -2.5))
MOI.get(m, MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}())
gives: MethodError: no method matching get_quadratic_terms_objective(::Gurobi.GurobiOptimizer)