[Bug Report] Process must exit before requested information can be determined

I encountered an issue when testing out the Sandbox Template of the Needle Engine. Below is my specs:

  • OS: Ubuntu 24.04
  • Unity: 6000.0.32f1
  • Needle Engine: 3.51.1
  • Node: v20.15.1

When I press “Play” for the Unity game, the build fails. Here is the error message:

InvalidOperationException: Process must exit before requested information can be determined.
System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) (at <8d1920f66fd6494ebe24fa42f014ba27>:0)
System.Diagnostics.Process.get_ExitCode () (at <8d1920f66fd6494ebe24fa42f014ba27>:0)
Needle.Engine.Utils.ProcessHelper.RunCommand (System.String command, System.String workingDirectory, System.String logFilePath, System.Boolean noWindow, System.Boolean logToConsole, System.Nullable`1[T] parentId, System.Threading.CancellationToken cancellationToken, System.Action`2[T1,T2] onLog) (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:272)
Needle.Engine.Core.Builder.InternalOnBuild (Needle.Engine.Core.BuildContext buildContext, Needle.Engine.ProjectInfo projectPaths, Needle.Engine.Core.BuildInfo info) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:508)
Needle.Engine.Core.Builder.Build (System.Boolean isImplicitExport, Needle.Engine.Core.BuildContext buildContext, System.Int32 parentTaskId, System.Nullable`1[T] info) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:221)
UnityEngine.Debug:LogException(Exception)
Needle.Engine.Core.<Build>d__33:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:247)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
Needle.Engine.Core.<InternalOnBuild>d__35:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:614)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
Needle.Engine.Utils.<RunCommand>d__5:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:274)
UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:110)

To reproduce bug (as presented in the docs):

  1. Install Unity
  2. Install NodeJS
  3. Download the NE unitypackage
  4. Start Unity
  5. Import NE package
  6. Create NE project with Vite
  7. Start the Vite server
  8. Press “Play” - error occurs

I was able to modify the C# code for NE and determine that this line (within ProcessHelper) is the issue:

var code = proc?.ExitCode ?? -1;

By replacing with var code = -1;, the InvalidOperationException is not raised. I proposed adding a try-except here to prevent an uncaught exception.

Y’all are the best, thank you for the excellent dev experience!
Eduardo Davalos

Hello Eduardo Davalos,

The error you’re encountering, “Process must exit before requested information can be determined,” typically arises when the Needle Engine tries to run a command but encounters an issue with the subprocess execution. It can often relate to the environment setup, such as conflicting versions or system configurations.

Suggested Steps to Troubleshoot:

  1. Check Dependencies Compatibility

    • Ensure that the Unity version (6000.0.32f1) and Needle Engine (3.51.1) are compatible with Ubuntu 24.04. Sometimes, newer OS versions may lead to unanticipated issues.
  2. Permission Issues

    • Ensure that your project directory and the Needle Engine folders have the proper permissions. You may need to run Unity with elevated permissions.
  3. Environment Variables

    • Verify whether all required environment variables (especially related to Node.js and the Unity build process) are set correctly. This can impact the subprocess commands that Needle Engine is trying to execute.
  4. Updating to Latest Versions

    • If possible, consider updating both Unity and Needle Engine to the latest versions, as updates often contain important bug fixes.
  5. Consult Logs for More Details

    • Check Unity’s Console for additional logs or warnings leading up to this error to gain further insights.
  6. Testing in a Different Environment

    • If feasible, try running your project on another machine or environment to see if the issue persists.
  7. Reporting the Bug

    • If none of the above resolves the issue, consider reporting it to the Needle Engine support with detailed logs, so they can assist in addressing it.

If you have any additional logs or relevant details to share, feel free to provide them so we can further diagnose the issue.

Additionally, if you haven’t already, please consider referring to the documentation or samples provided by Needle Engine for guidance on project setup.

Feel free to ask if you need more specific instructions on any of these steps!

1 replies left - Get a PRO license for more AI replies.
thread_fDS9N6LyNUNaZBBDgSFKEqv8
Reply to this message to continue the conversation

Thank you for reporting and proposing a solution! That’s great. We will add a fix for the next update!

Hello again, this appears to be already fixed in the latest version of Needle Engine (4.x) which is currently in alpha.

Could you try updating via Unity’s Package Manager ?

Thank you