java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect

Jenkins JIRA | Andreas Kleber | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [JENKINS-24280] Environment variables get corrupted when using Node parameter - Jenkins JIRA

    jenkins-ci.org | 1 year ago
    java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect
  2. 0

    When I use a Node parameter at my jobs, it is not possible for jenkins anymore to start a windows batch script on a windows slave, because cmd.exe can not be found. If I use the Label parameter with that nodes name, everything works as expected. I do not kno if it is relevant but I also use the Environment Injector Plugin. Running Jenkins: 1.554.3, Node and Label parameter plugin: 1.5.1, Environment Injector Plugin 1.89 {code} Started by user Andreas Kleber [EnvInject] - Loading node environment variables. Building remotely on basstu01 (puppet vdp vdk windows) in workspace c:\j\workspace\test-env [test-env] $ cmd /c call C:\Users\XXX\AppData\Local\Temp\hudson4333783914616487877.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:773) at hudson.Launcher$ProcStarter.start(Launcher.java:353) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1023) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:990) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:328) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:63) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 17 more Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE {code}

    Jenkins JIRA | 3 years ago | Andreas Kleber
    java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect
  3. 0

    When I use a Node parameter at my jobs, it is not possible for jenkins anymore to start a windows batch script on a windows slave, because cmd.exe can not be found. If I use the Label parameter with that nodes name, everything works as expected. I do not kno if it is relevant but I also use the Environment Injector Plugin. Running Jenkins: 1.554.3, Node and Label parameter plugin: 1.5.1, Environment Injector Plugin 1.89 {code} Started by user Andreas Kleber [EnvInject] - Loading node environment variables. Building remotely on basstu01 (puppet vdp vdk windows) in workspace c:\j\workspace\test-env [test-env] $ cmd /c call C:\Users\XXX\AppData\Local\Temp\hudson4333783914616487877.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:773) at hudson.Launcher$ProcStarter.start(Launcher.java:353) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1023) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:990) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:328) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:63) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 17 more Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE {code}

    Jenkins JIRA | 3 years ago | Andreas Kleber
    java.io.IOException: Cannot run program "cmd" (in directory "c:\j\workspace\test-env"): CreateProcess error=87, The parameter is incorrect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    "hg pull" fails when Jenkins is a Windows Service

    Stack Overflow | 2 years ago
    java.io.IOException: Cannot run program "hg" (in directory "D:\Hudson\workspace\MercurialTest"): CreateProcess error=87, The parameter is incorrect
  6. 0

    When using the Node Label Parameter plugin it breaks any build steps that run Windows batch files if you don't fill in a value for the Name field. To reproduce, create a new free style job and select the "This build is parameterized" option. Select a default slave that is a windows machine. Leave the Name field empty. Add a build step to run a Windows batch file and fill in a simple command like echo %PATH% or ver. When you run the job the build step will fail with an error message like this: Building remotely on WINDOWS_SERVER in workspace C:\jenkins\workspace\update-scripts-all-slaves [update-scripts-all-slaves] $ cmd /c call C:\Users\JENKIN~1.SIM\AppData\Local\Temp\hudson7760734931475434766.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "C:\jenkins\workspace\update-scripts-all-slaves"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:709) at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:934) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:901) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:60) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 17 more Build step 'Execute Windows batch command' marked build as failure This only happens if you leave the Name field empty as I originally did. It also only affects Windows batch files, linux shell command build steps work as expected even with an empty Name field.

    Jenkins JIRA | 4 years ago | Glenn Coombs
    java.io.IOException: Cannot run program "cmd" (in directory "C:\jenkins\workspace\update-scripts-all-slaves"): CreateProcess error=87, The parameter is incorrect
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    CreateProcess error=87, The parameter is incorrect

    at java.lang.ProcessImpl.create()
  2. Java RT
    ProcessBuilder.start
    1. java.lang.ProcessImpl.create(Native Method)
    2. java.lang.ProcessImpl.<init>(Unknown Source)
    3. java.lang.ProcessImpl.start(Unknown Source)
    4. java.lang.ProcessBuilder.start(Unknown Source)
    4 frames
  3. Hudson
    Launcher$RemoteLaunchCallable.call
    1. hudson.Proc$LocalProc.<init>(Proc.java:244)
    2. hudson.Proc$LocalProc.<init>(Proc.java:216)
    3. hudson.Launcher$LocalLauncher.launch(Launcher.java:773)
    4. hudson.Launcher$ProcStarter.start(Launcher.java:353)
    5. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1023)
    6. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:990)
    6 frames
  4. Hudson :: Remoting Layer
    InterceptingExecutorService$1.call
    1. hudson.remoting.UserRequest.perform(UserRequest.java:118)
    2. hudson.remoting.UserRequest.perform(UserRequest.java:48)
    3. hudson.remoting.Request$2.run(Request.java:328)
    4. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    4 frames
  5. Java RT
    ThreadPoolExecutor$Worker.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    2. java.util.concurrent.FutureTask.run(Unknown Source)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    4 frames
  6. Hudson :: Remoting Layer
    Engine$1$1.run
    1. hudson.remoting.Engine$1$1.run(Engine.java:63)
    1 frame
  7. Java RT
    Thread.run
    1. java.lang.Thread.run(Unknown Source)
    1 frame