the error occurs when the where condition returns no rows, so toarray()(0) is accessed on an empty array; fix it by using firstordefault and checking for nothing, or use this safer linq:
dataDt.asenumerable().
select(function(r, i) new with {.idx = i, .val = r(0).tostring}).
where(function(x) x.val.contains(“searchedtext”)).
select(function(x) x.idx + 1).
firstordefault()
this returns the row number of the first match or 0 if not found.
If helpful, mark as solution. Happy automation with UiPath