gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Unhandled exception when using Ollama to generate commit message

Open stevensiebe opened this issue 8 months ago • 3 comments

Version

0.14.16

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

When using Ollama as an option to generate a commit message, I get the following error.

Unhandled exception
A promise had an unhandled exception
SyntaxError: Failed to execute 'close' on 
'ReadableStreamDefaultController': Unexpected end of JSON 
input

My endpoint is set to http://127.0.0.1:11434 my model is set to gemma3:latest

I know the endpoint is valid, as Page Assist and other applications use it. No matter what the model is set to, I get the same error.

Switching to Anthropic or Open AI in preferences and running the same operation work as expected. Just get an error when using Ollama.

How to reproduce (Optional)

No response

Expected behavior (Optional)

No response

Relevant log output (Optional)


stevensiebe avatar Apr 08 '25 23:04 stevensiebe

Thanks for reporting! It's probably an issue with how the App thinks the protocol should be used.

What might help here is to use the developer tools via View -> Developer Tools to get more information on the call that it made. From there it should be possible to figure out what's wrong with it. My guess is that the endpoint isn't used correctly so it will return an error message in a format that is not JSON. Thanks for your help!

CC @Caleb-T-Owens who may have some experience with this.

Byron avatar Apr 12 '25 09:04 Byron

Using a proxy to access a remote ollama, I had the same error. Starting in ollama with the environment variable OLLAMA_ORIGINS=* solved it for me.

jhony1104 avatar Apr 16 '25 10:04 jhony1104

These are the errors I see in the console board:1 [Intervention] Images loaded lazily and replaced with placeholders. Load events are deferred. See https://go.microsoft.com/fwlink/?linkid=2048113 Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. Tracking Prevention blocked access to storage for <URL>. board:1 Autofocus processing was blocked because a document already has a focused element. hooks.client.ts:36 PromiseRejectionEvent {isTrusted: true, reason: SyntaxError: Failed to execute 'close' on 'ReadableStreamDefaultController': Unexpected end of JSON…, type: 'unhandledrejection', target: Window, currentTarget: Window, …}isTrusted: truebubbles: falsecancelBubble: falsecancelable: truecomposed: falsecurrentTarget: Window {window: Window, self: Window, document: document, name: '', location: Location, …}defaultPrevented: falseeventPhase: 0promise: (...)reason: SyntaxError: Failed to execute 'close' on 'ReadableStreamDefaultController': Unexpected end of JSON input at S.onmessage (http://tauri.localhost/_app/immutable/chunks/ayvuQ9Kc.js:49:1355) at http://tauri.localhost/_app/immutable/chunks/BXPbXBim.js:1:1000 at value (<anonymous>:275:30) at <anonymous>:1:159returnValue: truesrcElement: Window {window: Window, self: Window, document: document, name: '', location: Location, …}target: Window {window: Window, self: Window, document: document, name: '', location: Location, …}timeStamp: 18865.700000001118type: "unhandledrejection"[[Prototype]]: PromiseRejectionEvent Z @ hooks.client.ts:36 window.onunhandledrejection @ hooks.client.ts:24 VM222:1 Uncaught (in promise) SyntaxError: Failed to execute 'close' on 'ReadableStreamDefaultController': Unexpected end of JSON input at S.onmessage (index.js:130:32) at core.js:88:71 at value (<anonymous>:275:30) at <anonymous>:1:159 S.onmessage @ index.js:130 (anonymous) @ core.js:88 value @ VM12:275 (anonymous) @ VM221:1 Promise.then (anonymous) @ VM221:1

stevensiebe avatar Apr 19 '25 06:04 stevensiebe