Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to lock variable. The variable cannot be found

Tags:

ssis

In SSIS I am trying to use a file system task to move a file to an archive directory. This is what my task looks like - http://imgur.com/raPZIzL

When I run the package I get a failure on this task: Error: 0xC0014054 at File System Task: Failed to lock variable "\xxx\yyyy\Eligibility\SOURCE_ELIGIBILITY_IMPORT_0482014.CSV" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

I find it interesting that it's saying the variable is not found because the initial value of the variable is 'temp' (see screen shot) and then I set the value of the variable in a script task several steps before this task runs. So I know the variable exists and it has the proper value (I can open the file in the variable path). I just don't know why or how to get around this. I found the same message posted by others on the internet but none of the solutions worked for me. I don't see how this could be a race condition either, the script task which sets the value of the variable finishes a second or so before this task runs.

I have tried deleting the File System Task and recreating it, still get the error. I also restarted the computer thinking that might help but it didn't.

EDIT: more info...if I set DelayValidation from True to False, I get the same error before anything even runs, although this time it's complaining about the initial value of the variable before it has a chance to be set in code.

Here are the specific errors:

Error: 0xC0014054 at File System Task: Failed to lock variable "\XXX\YYYY\Eligibility\SOURCE_ELIGIBILITY_IMPORT_0482014.CSV" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

Error: 0xC002F304 at File System Task, File System Task: An error occurred with the following error message: "Failed to lock variable "\XXX\YYYY\Eligibility\SOURCE_ELIGIBILITY_IMPORT_0482014.CSV" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.". ".

Error: 0xC0014054 at File System Task: Failed to lock variable "\XXX\YYYY\Eligibility\Archive" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

Error: 0xC002F304 at File System Task, File System Task: An error occurred with the following error message: "Failed to lock variable "\XXX\YYYY\Eligibility\Archive" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

like image 260
Baub Avatar asked Apr 08 '14 17:04

Baub


1 Answers

After much testing I found it was a problem with the Expressions. It seems every time I went into the expressions area and joined two variables together, that is when the problems started.

I was simply taking a base directory and adding "Archive" to the end, in the Expression builder area it would evaluate correctly but the package would fail. However, if I opened my File Task to get to the editor and I use the drop down list for the DestinationVariable property and select a variable from that list, it all worked fine.

So I ended up creating a few more variables (one for each file I am going to move) and then setting that value to the base directory + "Archive", then I selected that variable from the drop down list for the DestinationVariable property. Ran without errors.

like image 63
Baub Avatar answered Jan 03 '23 10:01

Baub