We have a site that uses backupsets for extended retention (which I hate, but that's beside the point). I had a number of restores (and "QUERY BACKUPSETCONTENTS" commands) that were failing with the error "Command failed – internal server error detected." Further research into the problem revealed only that 9999D means "thread terminated", with no other specific information.
After a call to Tivoli support, and some exchanging of some logs, it was determined that tape containing the backupset was not in the library. When the "request" timer would expire, the server would terminate the thread, but no "message" would return. This includes running commands from the server and client command line interfaces. You can replicate the error by running the command in one window, then canceling the request on the server in another. The Tivoli rep said that he would send it to the developers, so this may be "fixed" to include a proper error message in a future version.