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

Jenkins JIRA | Shijun Kong | 9 months ago
  1. 0

    First encounter this issue, when someone accidentally removed key value of one global properties. Suddenly all jobs started failing with exception message say "Parameter is incorrect" without detail information. Aware of the property change, spent a few hours to track down this issue. It turned out, not just global properties, a parameterized build job which has one parameter with empty key value, could cause the same error. Ideally, global properties, parameterized build config, should not allow key as empty in the first place. But there are many plugins could set properties which end up to environment properties passed to windows process. Could Jenkins do one of the following steps: 1) after consolidate all environment properties, do a validation, if found empty key, break and print out all details Or 2) after empty key found, skip it Steps to re-produce: 1) create a free style job 2) config it as parameterized build, add a String parameter, with key left as empty, value equals to "xyz" 3) add build step, execute windows shell script with just one command: echo %path% output: {code} [TestCmd] $ cmd /c call C:\Users\xyz\AppData\Local\Temp\hudson2947220984372050691.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "c:\workspace\TestCmd"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:385) at java.lang.ProcessImpl.start(ProcessImpl.java:136) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 15 more {code}

    Jenkins JIRA | 9 months ago | Shijun Kong
    java.io.IOException: Cannot run program "cmd" (in directory "c:\workspace\TestCmd"): CreateProcess error=87, The parameter is incorrect
  2. 0

    First encounter this issue, when someone accidentally removed key value of one global properties. Suddenly all jobs started failing with exception message say "Parameter is incorrect" without detail information. Aware of the property change, spent a few hours to track down this issue. It turned out, not just global properties, a parameterized build job which has one parameter with empty key value, could cause the same error. Ideally, global properties, parameterized build config, should not allow key as empty in the first place. But there are many plugins could set properties which end up to environment properties passed to windows process. Could Jenkins do one of the following steps: 1) after consolidate all environment properties, do a validation, if found empty key, break and print out all details Or 2) after empty key found, skip it Steps to re-produce: 1) create a free style job 2) config it as parameterized build, add a String parameter, with key left as empty, value equals to "xyz" 3) add build step, execute windows shell script with just one command: echo %path% output: {code} [TestCmd] $ cmd /c call C:\Users\xyz\AppData\Local\Temp\hudson2947220984372050691.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: Cannot run program "cmd" (in directory "c:\workspace\TestCmd"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:815) at hudson.Launcher$ProcStarter.start(Launcher.java:381) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:385) at java.lang.ProcessImpl.start(ProcessImpl.java:136) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 15 more {code}

    Jenkins JIRA | 9 months ago | Shijun Kong
    java.io.IOException: Cannot run program "cmd" (in directory "c:\workspace\TestCmd"): CreateProcess error=87, The parameter is incorrect
  3. 0

    [JENKINS-15475] CreateProcess error=87, The parameter is incorrect - Jenkins JIRA

    jenkins-ci.org | 8 months ago
    java.io.IOException: Cannot run program "cmd" (in directory "C:\Users\alexo\jenkins\jobs\run_cmd\workspace\default"): CreateProcess error=87, The parameter is incorrect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to Run job on Jenkins with Selenium Server

    Stack Overflow | 1 year ago | Khalid Ksouri
    java.io.IOException: Cannot run program "cmd" (in directory "/appli/projects/jenkins_atos/jenkins/workspace/STM_V1_V2_TESTS"): java.io.IOException: error=2, No such file or directory
  6. 0

    Java Doc generation failing

    GitHub | 2 years ago | edanian
    java.io.IOException: Cannot run program "mvn.bat" (in directory "C:\Program Files (x86)\Jenkins\workspace\gameoflife-default"): CreateProcess error=2, The system cannot find the file specified

  1. eti22 1 times, last 1 month ago
  2. asdasd 24 times, last 3 months ago
  3. rexgreenza 8 times, last 3 months ago
  4. Benj-AD 1 times, last 4 months ago
  5. Akshay 4 times, last 6 months ago
95 unregistered visitors
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>(ProcessImpl.java:385)
    3. java.lang.ProcessImpl.start(ProcessImpl.java:136)
    4. java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
    4 frames
  3. Hudson
    Executor.run
    1. hudson.Proc$LocalProc.<init>(Proc.java:244)
    2. hudson.Proc$LocalProc.<init>(Proc.java:216)
    3. hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
    4. hudson.Launcher$ProcStarter.start(Launcher.java:381)
    5. hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
    6. hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
    7. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    8. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
    9. hudson.model.Build$BuildExecution.build(Build.java:205)
    10. hudson.model.Build$BuildExecution.doRun(Build.java:162)
    11. hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    12. hudson.model.Run.execute(Run.java:1738)
    13. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    14. hudson.model.ResourceController.execute(ResourceController.java:98)
    15. hudson.model.Executor.run(Executor.java:410)
    15 frames