longer object length is not a multiple of shorter object length

I am computing a test error using this code

test_error = mean((train_set$dis - yhat_test)^2)
test_error

R is given me a warning which say "longer object length is not a multiple of shorter object length"
I kind of know the issue. I think the train_set is a list and yhat_test is a double, which is why i am getting the warning.