Skip to content

Every request to ollama ends up in "Cannot read properties of undefined (reading 'createMessageContent')" #15475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xpomul opened this issue Apr 16, 2025 · 0 comments · Fixed by #15476

Comments

@xpomul
Copy link
Contributor

xpomul commented Apr 16, 2025

Bug Description:

This seems to be a regression in Theia 1.60, introduced with #15092 (see below).
Since upgrading to Theia 1.60, every request to ollama (in the code, every call to OllamaModel.request fails with the error Cannot read properties of undefined (reading 'createMessageContent')

Steps to Reproduce:

  1. Start Theia IDE or a Theia application that includes the AI modules.
  2. Enable AI, Configure ollama (note: this does not even need a local ollama server running to reproduce), configure the chat naming agent and the Orchestrator agent to use an ollama model.
  3. Open AI Chat and enter any message.

Expected behavior:

The chat agent answers the message.

Actual behavior:

The chat view reports the error:
Cannot read properties of undefined (reading 'createMessageContent')

Additional Information

  • Operating System: MacOS, Arm64 (M1 MacBook)
  • Theia Version: Theia IDE 1.60.200

Anaylsis:

In the line

messages: request.messages.map(this.toOllamaMessage).filter(m => m !== undefined) as Message[],

and the following line, we pass methods to the map() function which causes this to be unbound when the methods are called.

This was like this already in previous versions, but only since #15092, this is referenced within toOllamaMessage() which introduces the bug.

xpomul added a commit to xpomul/theia that referenced this issue Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant