Is "make the largest possible X but not too large" grammatical? [closed]

Someone claimed this sentence is using incorrect grammar:

Make the largest possible X but not too large.

Context: imagine you have an API that tells you the largest supported size. You want to test whether that size is actually supported, but if the API reports a size larger than the amount of memory you have that would be "too large".

Is this incorrect English usage?

Update:

I'm only asking about the grammar. I'm not looking for suggestions on better ways to phrase things. Remember that the sentence has a context. If someone says "Go to the jewelry store and buy me the most expensive necklace but not too expensive", whether that is correct grammar is a valid question by itself.

The person being asked to go might then ask "How expensive is too expensive?" but whether or not that clarifying question exists is independent from whether or not the first sentence is grammatical or ungrammatical.


Solution 1:

Comprehensiblity, grammaticality and internal consistency etc are different things that are sometimes lazily described simply as 'grammar'. Your follow-up question about "English usage" is much broader, but I will ignore that breadth here since the question title and the update posted in the question restrict your scope of interest for this question to grammar.

We can consider the sentence to be of the form "Make it X but not Y". This is grammatical.

The structure of your quote is the same as that of one considered by Quote Investigator. Quote Investigator cites a New York Times article by Roger Sessions that includes the following paraphrase of a famous Einstein quote: "... everything should be made as simple as possible, but not simpler".