Attempt to submit a form using Map<String, String> results in EncodeException · Issue #2827 · OpenFeign/feign · GitHub
Skip to content

Attempt to submit a form using Map<String, String> results in EncodeException #2827

Open

Description

@gkresic

One of our Feign clients looked like:

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "authClient", url = "${auth.url}", configuration = AuthClient.Configuration.class)
public interface AuthClient {

    @PostMapping(value = "/oauth2/token", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    AuthResponse getAccessToken(@RequestBody Map<String, ?> request);

}

This works. However, changing request type from Map<String, ?> to Map<String, String> causes Feign to fail with:

feign.codec.EncodeException Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @531be3c5

During my investigation, I learned about Feign's close relationship with Map<String, ?> via feign.codec.Encoder#MAP_STRING_WILDCARD, but even if this is not a bug, but a design choice, it just seems like it should be handled more gracefully.

io.github.openfeign:feign-core:12.5
io.github.openfeign:feign-okhttp:13.2.1
io.github.openfeign.form:feign-form:3.8.0
io.github.openfeign.form:feign-form-spring:3.8.0
io.github.openfeign:feign-slf4j:12.5
org.springframework.cloud:spring-cloud-starter-openfeign:4.0.6
OpenJDK 21

Activity

  1. added
    questionGeneral usage or 'how-to' questions
    on Jun 4, 2026
  2. velo commented on Jun 4, 2026

    @velo
    Member

    Thanks for the report. This project is community-maintained, and the maintainer will not implement fixes or features directly. If you want this to move forward, please open a pull request with automated tests that cover the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionGeneral usage or 'how-to' questions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions