Skip to content

Configuration footgun: trailing whitespace in "Base URL" results in confusing connection errors ("The language model did not provide any assistant messages") and is not visible in the UI #4051

@przem8k

Description

@przem8k

What happened?

The issue occurs when users configure Cline with a provider that takes custom base URL, for example "OpenAI Compatible".

If the user pastes in the base URL copied from some document, they may accidentally include trailing whitespace at the end of the URL, for example: https://example.com/llm (note the space at the end)

This results in the most confusing of behaviors 💫 : firstly because the UI immediately hides the trailing whitespace: it gets trimmed away so you can't notice that it's there. Secondly, because the trailing whitespace does become part of the effective URL used by Cline for connections. The resulting behavior is that all connections fail with the same error:

Unexpected API Response: The language model did not provide any assistant messages. This may indicate an issue with the API or the model's output.
Image

Suggested improvements:

  • trim trailing whitespace not just in the UI, but in the underlying data model
  • is it possible to have more granular errors when the connection to the server fails? In this case "The language model did not provide any assistant messages." is misleading, "Failed to connect to the language model" would be better. Even better if there was a way to see the HTTP response code and content.

Thanks for the great work on Cline, I'm a very happy user 🙌

Steps to reproduce

  1. Configure OpenAI Compatible API backend with a trailing whitespace at the end of the URL
  2. Try making any Cline requests

Relevant API REQUEST output

Provider/Model

any model

Operating System

any OS

System Info

any system

Cline Version

3.17.10

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions