Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-11701

Matrix build problem with Ant build step: "The file is either empty or does not contain the valid choices."

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • ant-plugin, core
    • None
    • Jenkins 1.428
      Slave:
      Windows 2003
      Ant 1.8.1/Ant 1.8.2

      I have a matrix build that executes JUnit tests in an Ant build step on different platforms.
      One of them is a Windows 2003 slave.

      Only in this matrix configuration the build fails with the following error:

      BUILD SUCCESSFUL
      Total time: 1 minute 13 seconds
      
      ERROR: The file is either empty or does not contain the valid choices.
      

      Google brought up an old Hudson user list thread about possible "Leaked File Descriptor"-Issues:
      http://java.net/projects/hudson/lists/users/archive/2010-09/message/450

      This seems unlikely, because running this particular configuration as a separate Jenkins project works fine.

      I tried to find the error string to isolate the problem, but haven't found it yet.

      Any pointers are appreciated!

          [JENKINS-11701] Matrix build problem with Ant build step: "The file is either empty or does not contain the valid choices."

          Fred G added a comment -

          The problem was that I set an environment variable with the name "os" which lead to errors when an Ant script is called on a Windows machine.

          In my case I used "os" as the axis name of my matrix build. When the particular matrix configuration was executed on the Windows machine, "os" was set to "win32". (This is not specific to matrix builds. The same thing can happen if a string parameter "os" is used in a parameterized freestyle project.)
          In both cases the environment variable "OS" will be overwritten.
          I never thought of this before, because I set an Ant property with the name "os" all the time.

          The "ant.bat" script (which is located in the ant installations's bin dir) expects the "OS" environment variable to be set to the default value "Windows_NT" (at least on Windows XP & 2003). If "OS" has a different value, Ant always exits with an error.

          Up to Ant version 1.8.1 it printed out "ERROR: The file is either empty or does not contain the valid choices.", with version 1.8.2 it does not print out any error and just fails.

          http://osdir.com/ml/db.monetdb.bugs/2008-02/msg00085.html dealed with the same problem and gave good pointers.

          Final verdict: Avoid setting build/environment variables that have the same name as important environment variables (if you are not completely sure what you're doing).

          Fred G added a comment - The problem was that I set an environment variable with the name "os" which lead to errors when an Ant script is called on a Windows machine. In my case I used "os" as the axis name of my matrix build. When the particular matrix configuration was executed on the Windows machine, "os" was set to "win32". (This is not specific to matrix builds. The same thing can happen if a string parameter "os" is used in a parameterized freestyle project.) In both cases the environment variable "OS" will be overwritten. I never thought of this before, because I set an Ant property with the name "os" all the time. The "ant.bat" script (which is located in the ant installations's bin dir) expects the "OS" environment variable to be set to the default value "Windows_NT" (at least on Windows XP & 2003). If "OS" has a different value, Ant always exits with an error. Up to Ant version 1.8.1 it printed out "ERROR: The file is either empty or does not contain the valid choices.", with version 1.8.2 it does not print out any error and just fails. http://osdir.com/ml/db.monetdb.bugs/2008-02/msg00085.html dealed with the same problem and gave good pointers. Final verdict: Avoid setting build/environment variables that have the same name as important environment variables (if you are not completely sure what you're doing).

            fredg Fred G
            fredg Fred G
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: