Skip to content

MAX_EXPRESSION_LENGTH should not be fixed to 10000 but custom #2916

Closed

Description

@AdrienNguyenWorldline

feign.template.Expressions limit of MAX_EXPRESSION_LENGTH = 10000 added by commit 8d9fe72 should be configurable to a custom value and/or being able to be disabled by setting it to 0.

Activity

  1. rojae commented on Jun 23, 2025

    @rojae
    Contributor

    Not sure if expressions would realistically exceed 10,000 characters,
    but it's something that might be worth considering.

  2. rojae commented on Jun 23, 2025

    @rojae
    Contributor

    I found that this exception (expression is too long. Max length: 10000) doesn't occur when using Spring Cloud OpenFeign.

    That's because OpenFeign builds the RequestTemplate based on annotations, and it skips the strict validation Expressions.create() that happens when calling template.uri(...) directly in Feign core.
    So even if the URI is longer than 10,000 characters, it doesn’t throw an error.

    For reproduce the exception, need to use Feign core directly and create the template with new RequestTemplate().uri(...)

    Here is reproduce code

    import feign.RequestTemplate;
    
    public class TemplateLengthTest {
        public static void main(String[] args) {
            // 10,001 expression string, occur exception "expression is too long. Max length: 10000"
            String longUri = "/{" + "A".repeat(10001) + "}";
            RequestTemplate template = new RequestTemplate();
            template.uri(longUri);
        }
    }
  3. added
    enhancement
    proposal
    on Jun 4, 2026
  4. 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.

  5. added a commit that references this issue on Jun 22, 2026
    837dcd5
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

    enhancementproposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions