Skip to content

Windows installer complains about not being able to update the PATH variable #2897

Open

Description

@totkeks

Expected Behavior

Installer completes without any issue.

Actual Behavior

Installer completes with error on updating the PATH variable.
image

Steps to Reproduce the Problem

  1. winget update Balena.BalenaCLI

Specifications

  • balena CLI version: 20.1.0
  • Operating system version: Windows 26120.2702 (Win11, 24H2 Dev Insider)
  • 32/64 bit OS and processor: 64-bit
  • Install method: winget (uses installer.exe)

Additional

I don't know if this error relates to updating the current PATH variable of the current console session or to the PATH variable in the system environment, which resides in the registry.

From my quick research the limit doesn't seem to be 1024 and also not 2048. Because I am above those and got no issues.

Manually checking the path results in 1853 characters. And checking the raw value in the registry it is only 796 characters.

The path in registry also contains many vars like %USERPROFILE, which shortens it even more.

From my research the supported length could be 4096 or even more.

API documentation says one should not use more than 2048 characters (https://learn.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable?view=net-8.0#system-environment-setenvironmentvariable(system-string-system-string))

If target is EnvironmentVariableTarget.User or EnvironmentVariableTarget.Machine, we recommend that the length of value be less than 2048 characters.

Activity

  1. Misiu commented on Apr 7, 2025

    @Misiu

    same issue with balena cli v21.1.8

    Image

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions