Toad World® Forums

Exception has been thrown by the target of an invocation

I am getting the error above when trying to run an automation (.tas file). My automation loops through several values importing data into SQL server (various dates and locations) and has been working for the past year. This worked last month. It gets through the first 119 loops then gives the error above and stops.

Here is what I found in the ExceptionTrace.log:

New exception: 4/15/2020 11:45:10 AM

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\martin38\AppData\Local\Temp\1\731482be-ca55-4bb2-9be7-84ad4ea5e541.tmp'.

Stack trace:

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Quest.FastData.FastTable.GetTempFileName()
at Quest.FastData.FastTable.RowCollection.SerializeRowData(Object data, FastSerialize serializers)
at Quest.FastData.FastTable.RowCollection.<>c__DisplayClass50_0.b__0(Object )

Outer exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Stack trace:

at Quest.FastData.FastTable.RowCollection.Add(Object item)
at Quest.FastData.FastTable.AddRowAccepted(Object data)
at Quest.Toad.ScriptResults.OutputStorageHandler.AddEntry(OutputEventArgs args)
at Quest.Toad.ScriptResults.OutputStorageHandler.NotificationManager_OutputEvent(Object sender, OutputEventArgs args)
at Quest.Toad.Notification.NotificationManager.SendOutput(Object sender, Int32 imageIndex, OutputCategory category, String text)
at Quest.Toad.ImportExport.ImportEngine.WriteLog(String message, DateTime time)
at Quest.Toad.ImportExport.ImportEngine.LogEvent(String message, Object args)
at Quest.Toad.ImportExport.ImportEngine.LogEventCallback(String message, LogEventType eventType, Object args)
at Quest.Toad.ImportExport.ImportData.LogEvent(String message, Object args)
at Quest.Toad.ImportExport.ImportData.SetTransactionAbort()
at Quest.Toad.ImportExport.ImportData.ImportSourceToTarget()

If I run the query manually with the arguments that caused this error, it produces data just fine.

Does anyone know what is causing this and why it would have started this month?

I was able to get this script to run. I had to add a folder titled '1' based on this info

System.IO.DirectoryNotFoundException: Could not find a part of the path

Does anyone know why that '1' folder would have been deleted? I don think I did it and am wondering if another toad script I run is doing that.

What have you got in Tools | Options | Database | Script Result: Serialization Temporary Folder? If it's a network folder, can you set it to a local folder that you can access?

Hey Dan,

In that field all I see is


which is a local directory. Are you suggesting I change it out of the appData folder?

The default is C:\Users%username%\AppData\Local\Temp
Can you set it to this?

1 Like

Hey Dan,

I think that fixed it. Do you know what could have caused that to change? I have been running this for over 6 months and this had never happened before.

I don't know. But we've only had one case of this error so it must be same rare circumstances.
Glad it's fixed though!