Whatever is calling ProcessTVCommand() is passing a resource (file handle, stream, db handle, etc.) instead of a string.
First, are you using the current version of MODX? It may be fixed for you.
This might fix it:
if (is_string($value) {
$nvalue = trim($value);
}
If not, turning off E_NOTICE warnings would likely make it go away.
If you are using the current version of MODX, please report it as a bug via the "Bugs" link at the top of this page. It would help a lot if you can give details about the TV that's causing the problem.