Error while running a package script

I am getting the following error when trying to run a package script in CommandBox. I am using version 4.1.0+01030 running on Windows 10.

box run-script build

Has any other Windows users encountering this? I have not tried deleting my .CommandBox directory yet.

BOOM GOES THE DYNAMITE!!
We’re truly sorry, but something horrible has gone wrong when starting up CommandBox.
Here’s what we know:.

Message:
[6] The handle is invalid.

Tag Context:
C:\Users\jason.CommandBox\cfml\system\util\InteractiveJob.cfc: line 46
called from C:\Users\jason.CommandBox\cfml\system\util\InteractiveJob.cfc: line 36
called from C:\Users\jason.CommandBox\cfml\system\wirebox\system\core\dynamic\MixerUtil.cfc: line 225
called from C:\Users\jason.CommandBox\cfml\system\wirebox\system\ioc\Injector.cfc: line 840
called from C:\Users\jason.CommandBox\cfml\system\wirebox\system\ioc\Injector.cfc: line 648
called from C:\Users\jason.CommandBox\cfml\system\wirebox\system\ioc\scopes\Singleton.cfc: line 78
called from C:\Users\jason.CommandBox\cfml\system\wirebox\system\ioc\Injector.cfc: line 364
called from C:\Users\jason.CommandBox\cfml\system\Shell.cfc: line 725
called from C:\Users\jason.CommandBox\cfml\system\Bootstrap.cfm: line 119

lucee.runtime.exp.NativeException: [6] The handle is invalid.
at com.sun.jna.Native.invokeVoid(Native Method)
at com.sun.jna.Function.invoke(Function.java:407)
at com.sun.jna.Function.invoke(Function.java:353)
at com.sun.jna.Library$Handler.invoke(Library.java:244)
at org.jline.terminal.impl.jna.win.$Proxy0.GetConsoleScreenBufferInfo(Unknown Source)
at org.jline.terminal.impl.jna.win.JnaWinSysTerminal.getSize(JnaWinSysTerminal.java:62)
at org.jline.terminal.Terminal.getWidth(Terminal.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:55)
at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:852)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:797)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at system.util.interactivejob_cfc$cf.udfCall1(/commandbox/system/util/InteractiveJob.cfc:46)
at system.util.interactivejob_cfc$cf.udfCall(/commandbox/system/util/InteractiveJob.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:771)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at system.util.interactivejob_cfc$cf.udfCall1(/commandbox/system/util/InteractiveJob.cfc:36)
at system.util.interactivejob_cfc$cf.udfCall(/commandbox/system/util/InteractiveJob.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:206)
at lucee.runtime.tag.Invoke.doFunction(Invoke.java:235)
at lucee.runtime.tag.Invoke.doEndTag(Invoke.java:202)
at system.core.dynamic.mixerutil_cfc$cf.udfCall2(/wirebox/system/core/dynamic/MixerUtil.cfc:225)
at system.core.dynamic.mixerutil_cfc$cf.udfCall(/wirebox/system/core/dynamic/MixerUtil.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:689)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2005)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall3(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc:840)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:771)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall1(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc:648)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:689)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2005)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737)
at system.ioc.scopes.singleton_cfc$cf.udfCall(/wirebox/system/ioc/scopes/Singleton.cfc:78)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall1(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc:364)
at users.jason._commandbox46.cfml.system.wirebox.system.ioc.injector_cfc$cf.udfCall(/__commandbox_root/Users/jason/.CommandBox/cfml/system/wirebox/system/ioc/Injector.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718)
at system.shell_cfc$cf.udfCall4(/commandbox/system/Shell.cfc:725)
at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:689)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2005)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737)
at users.jason._commandbox46.cfml.system.bootstrap_cfm$cf.call(/__commandbox_root/Users/jason/.CommandBox/cfml/system/Bootstrap.cfm:119)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:933)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:823)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:805)
at x319sx3dk6bb.call(Unknown Source)
at lucee.runtime.compiler.Renderer.tag(Renderer.java:113)
at lucee.runtime.compiler.Renderer.script(Renderer.java:101)
at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:64)
at lucee.runtime.jsr223.ScriptEngineImpl.eval(ScriptEngineImpl.java:199)
at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:283)
at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:150)
at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:506)
Caused by: com.sun.jna.LastErrorException: [6] The handle is invalid.
… 99 more

I have. Usually it’s because of an error in the CF that I’m trying to run.

I’ve never seen that before. It looks like a bug in the JLine library. The error is this line of code here which runs when the interactive job CFC inits itself (not even being used yet)

if( terminal.getWidth() == 0 ) {

What terminal/console and OS are you using? Those calls at the top of the stack trace are from the deep underlying JNA libraries that JLine uses to communicate with your native OS terminal. Also, does the error happen if you just open up box and run the package script from inside? Does it happen if you run some other command like “box version”? The code in question doesn’t really seem to have anything to do with your package script, it’s just WireBox loading up CFs and such.

I am on Windows 10. I was using cmder but also tried cmd.exe and got the same error. The error also happens if I run it from within the CommandBox shell. box version and other commands I have used such as install and server start seem to work fine. I also tried changing the package script but it didnt seem to matter. I will play around with it some more and let you know if I figure anything out.

Cmder is basically a portable ConEMU. I’ve used both cmd and ConEMU on my Windows 10 laptop without issue. Can you share the stack trace of the error when you get it while running a command inside the shell. I’m a little confused since the error in the first stack trace you showed appeared to just be part of the startup routines of CommandBox and not even related to a specific command or package script.
If you can reproduce it, I’d like to enter a ticket for JLine. Also, for what it’s worth, you could grab the snapshot build of CommandBox. I recently upgraded the Jline version to 3.8.2 which may or may not affect this.

I removed my .CommandBox directory and started fresh and it is working now. I must of had something in there causing a problem. Thanks for the help and sorry for wasting your time.

Jason