The function coerceVariableValues in https://github.com/graphql/graphql-js/blob/main/src/execution/values.ts can throw several errors if the provided variable values aren't good. These are all bad user input, not server bugs, so Apollo Server should throw them as UserInputError rather than internal server errors. Unfortunately graphql-js doesn't give a great way of differentiating these errors from errors in server code and so we treat them like internal server errors.
In #5091 we fixed one of these errors (Variable "$${varName}" got invalid value) to throw UserInputError but other errors like Variable "$${varName}" of required type "${varTypeStr}" was not provided and Variable "$${varName}" of non-null type "${varTypeStr}" must not be null still show up as internal server errors. See #3498 (comment) for a codesandbox that demonstrates both issues. We should make them both into UserInputError.
The function
coerceVariableValuesin https://github.com/graphql/graphql-js/blob/main/src/execution/values.ts can throw several errors if the provided variable values aren't good. These are all bad user input, not server bugs, so Apollo Server should throw them as UserInputError rather than internal server errors. Unfortunatelygraphql-jsdoesn't give a great way of differentiating these errors from errors in server code and so we treat them like internal server errors.In #5091 we fixed one of these errors (
Variable "$${varName}" got invalid value) to throw UserInputError but other errors likeVariable "$${varName}" of required type "${varTypeStr}" was not providedandVariable "$${varName}" of non-null type "${varTypeStr}" must not be nullstill show up as internal server errors. See #3498 (comment) for a codesandbox that demonstrates both issues. We should make them both into UserInputError.