This error occurs when directly using the views_embed_view function inside a render function. Fix this by making it a variable first, and rendering it then.

$view = views_embed_view($viewName,$viewDisplayId);
$view = render($view);