[GH-ISSUE #3935] ERROR:The handle is invalid #48951

Closed
opened 2026-04-28 10:16:55 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Davidmax2023 on GitHub (Apr 26, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3935

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

when i run ollama ,get error information as below:
"failed to get console mode for stdout: The handle is invalid.
failed to get console mode for stderr: The handle is invalid."

OS

Windows

GPU

Intel

CPU

Intel

Ollama version

No response

Originally created by @Davidmax2023 on GitHub (Apr 26, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3935 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? when i run ollama ,get error information as below: "failed to get console mode for stdout: The handle is invalid. failed to get console mode for stderr: The handle is invalid." ### OS Windows ### GPU Intel ### CPU Intel ### Ollama version _No response_
GiteaMirror added the bugwindows labels 2026-04-28 10:16:55 -05:00
Author
Owner

@dhiltgen commented on GitHub (May 1, 2024):

Is there anything unusual in how you're running the ollama CLI? We attempt to discover the console mode on windows so we can adjust the mode to enable ANSII escape codes to support our progress reporting, and interactivity. Is the CLI otherwise working properly?

<!-- gh-comment-id:2089162305 --> @dhiltgen commented on GitHub (May 1, 2024): Is there anything unusual in how you're running the `ollama` CLI? We attempt to discover the console mode on windows so we can adjust the mode to enable ANSII escape codes to support our progress reporting, and interactivity. Is the CLI otherwise working properly?
Author
Owner

@johnstrand commented on GitHub (May 20, 2024):

When I run ollama run <model> "some input" > myFile.txt or ollama run <model> "some input" | Out-File myFile.txt the first line of the file will be failed to get console mode for stdout: The handle is invalid.

I've tried via Windows Terminal and VS Code's built in terminal, both with the same result. The output of the run is added to the command as expected.

The processing indicator is still shown in the console window as well. Aside from the errant line I can't see anything strange in the output or behavior.

<!-- gh-comment-id:2120665406 --> @johnstrand commented on GitHub (May 20, 2024): When I run `ollama run <model> "some input" > myFile.txt` or `ollama run <model> "some input" | Out-File myFile.txt` the first line of the file will be `failed to get console mode for stdout: The handle is invalid.` I've tried via Windows Terminal and VS Code's built in terminal, both with the same result. The output of the run is added to the command as expected. The processing indicator is still shown in the console window as well. Aside from the errant line I can't see anything strange in the output or behavior.
Author
Owner

@dhiltgen commented on GitHub (May 20, 2024):

Thanks for clarifying. Yes, we appear to have a bug in how we're trying to discover the console in windows when you redirect to a file. This is effectively a dup of #3826

<!-- gh-comment-id:2121232966 --> @dhiltgen commented on GitHub (May 20, 2024): Thanks for clarifying. Yes, we appear to have a bug in how we're trying to discover the console in windows when you redirect to a file. This is effectively a dup of #3826
Author
Owner

@chhaya-jay-56 commented on GitHub (Oct 13, 2024):

how to fix the bro if you know ?

<!-- gh-comment-id:2408863057 --> @chhaya-jay-56 commented on GitHub (Oct 13, 2024): how to fix the bro if you know ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#48951