Skip to content

UnknownContentTypeException when client authentication to server fails #1723

Closed

Description

@eduanb

When the server has Spring Security, like a basic auth username and password, and the client is misconfigured you get this error:

Caused by: org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.config.environment.Environment] and content type [text/html;charset=UTF-8]

This is very misleading to the user. Since the endpoint does return a 403, it should be simple to improve the error handling for the user. Here is an example of someone running into the error on StackOverflow https://stackoverflow.com/questions/59941635/spring-boot-2-2-2-release-could-not-locate-propertysource-could-not-extract

Activity

  1. hpoettker commented on Oct 12, 2023

    @hpoettker
    Contributor

    This problem usually appears when form login is enabled in the config server, which is often the case as the auto-configured SecurityFilterChain has form login enabled. When the config client sends the wrong credentials, the server will then respond with the HTML for the login page, which the client does not know how to handle.

    If you don't need form login in the config server, you can disable it to solve the issue.

  2. sharanggupta commented on Oct 15, 2026

    @sharanggupta
    Contributor

    I opened #3346 for this. When the config server answers with an HTML page, such as its login page, the client now reports the server URI, the status and the content type, and points at the credentials instead of the HttpMessageConverter error.

  3. added this to the 5.1.0-RC1 milestone on Oct 16, 2026
  4. added a commit that references this issue on Oct 16, 2026
    c5f2b20
  5. moved this from In Progress to Done in 2026.0.0-RC1on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions