That exception will occur if the field does not exist. For example...
input { generator { count => 1 lines => [ '' ] } }
filter {
mutate { add_field => { "[foo]" => 2501 } }
mutate { convert => { "[foo]" => integer } }
if [bar] >= 2500 {
mutate { add_field => { "[test]" => "Body too long" } }
}
}
output { stdout { codec => rubydebug { metadata => false } } }
will produce that exception.