Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

Error: spawn EINVAL running autorest legacy on windows #4676

Description

@jwaltz-bah

A recent Node JS update includes a breaking change to patch a security vulnerability: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2

When running autorest csharp v2 on Windows, the "spanw EINVAL" error occurs and stops execution.

Tested with both Node v21.7.3 and v18.20.2 (the patch was applied across all major Node versions)

Command:

autorest --input-file=swagger.json --csharp --legacy --add-credentials --namespace=MyApp.Model.Data --output-folder=MyApp.Model\Data

Console output:

AutoRest code generation utility [cli version: 3.7.1; node: v21.7.3]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    | AutoRest core version selected from configuration: ~2.0.4413.
   Loading AutoRest core      'C:\Users\me\.autorest\@microsoft.azureautorest-core@2.0.4429\nodemodules\@microsoft.azure\autorest-core\dist' (2.0.4429)
No configuration found at 'file:///C:/Users/me/repos/PPIThePricingAppIntegration/PricingApp/'.
   Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.102)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
Process() cancelled due to exception : spawn EINVAL
  Error: spawn EINVAL

Suggested solution from the Security Release announcement:

If the input to spawn/spawnSync is sanitized, users can now pass { shell: true } as an option to prevent the occurrence of EINVALs errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatv3Version 3 of AutoRest C# generator.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions