Skip to content

Windows: generated junie.bat fails with "The system cannot find the batch label specified - after_channel_oneshot" #72

Description

Windows: generated junie.bat fails with The system cannot find the batch label specified - after_channel_oneshot

Description

After installing Junie CLI on Windows using the official install.ps1 script, running junie --help fails with the following error:

The system cannot find the batch label specified - after_channel_oneshot

The issue was reproducible even after removing Junie and reinstalling it.

It looks like the generated Windows batch shim file junie.bat may be written with line endings that are not handled correctly by cmd.exe.

Rewriting the generated junie.bat file with Windows CRLF line endings fixed the issue.

Environment

  • OS: Windows 11
  • Shell: PowerShell
  • Junie command resolved to: C:\Users\andre\.local\bin\junie.bat

Installation command

powershell -NoProfile -ExecutionPolicy Bypass -Command "iex (irm 'https://junie.jetbrains.com/install.ps1')"

Steps to reproduce

  1. Install Junie CLI on Windows using the official installer:
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex (irm 'https://junie.jetbrains.com/install.ps1')"
  1. Run:
junie --help

Actual result

The command fails with:

The system cannot find the batch label specified - after_channel_oneshot

Expected result

junie --help should work immediately after installation.

Diagnostics

where.exe junie output:

C:\Users\andre\.local\bin\junie.bat

Get-Command junie -All output:

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     junie.bat                                          0.0.0.0    C:\Users\andre\.local\bin\junie.bat

So there does not appear to be another junie executable earlier in PATH. The command resolves only to the generated batch file:

C:\Users\andre\.local\bin\junie.bat

Workaround

The issue was fixed by rewriting the generated junie.bat file with Windows CRLF line endings:

$p = "$env:USERPROFILE\.local\bin\junie.bat"

Copy-Item $p "$p.bak" -Force

$text = [System.IO.File]::ReadAllText($p)
$text = $text -replace "`r?`n", "`r`n"

$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
[System.IO.File]::WriteAllText($p, $text, $utf8NoBom)

junie --help

After this, junie --help started working correctly.

Additional notes

This seems to indicate that the generated Windows batch shim may need to be written explicitly with CRLF line endings.

The batch file appears to jump to the :after_channel_oneshot label, but before normalizing line endings, cmd.exe fails with:

The system cannot find the batch label specified - after_channel_oneshot

After converting line endings to CRLF, the same generated batch file works correctly.

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