Exactly why you get this error most likely depends on what your code is doing at the time: there are a
huge number of different specific ways that you can cause this problem, though they are all related to accessing a different computer with the wrong authorisation type.
When you get an error that you don't understand, google it:
Google: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication[
^] If you have a look, there are a number of situations described with solutions to each. Find the problem which fits your exact situation, and try following a couple of links.