{"record":{"id":"51f315d8353c8510","repo":"prestodb/presto","slug":"table-function-invalid-arguments","errorCode":"TABLE_FUNCTION_INVALID_ARGUMENTS","errorMessage":"Too many arguments. Expected at most %s arguments, got %s arguments","messagePattern":"Too many arguments\\. Expected at most (.+?) arguments, got (.+?) arguments","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java","lineNumber":1941,"sourceCode":"                    // We don't enforce this requirement.\n                    if (analyzedProperColumnsDescriptor.isPresent()) {\n                        // If a table function has statically declared returned type, it is returned in TableFunctionMetadata\n                        // so the function's analyze() method should not return the proper columns descriptor.\n                        throw new SemanticException(TABLE_FUNCTION_AMBIGUOUS_RETURN_TYPE, node, \"Returned relation type for table function %s is ambiguous\", node.getName());\n                    }\n                    return ((DescribedTableReturnTypeSpecification) returnTypeSpecification).getDescriptor();\n            }\n        }\n\n        private ArgumentsAnalysis analyzeArguments(TableFunctionInvocation node, List<ArgumentSpecification> argumentSpecifications, Optional<Scope> scope)\n        {\n            List<TableFunctionArgument> arguments = node.getArguments();\n            Node errorLocation = node;\n            if (!arguments.isEmpty()) {\n                errorLocation = arguments.get(0);\n            }\n            if (argumentSpecifications.size() < arguments.size()) {\n                throw new SemanticException(TABLE_FUNCTION_INVALID_ARGUMENTS, errorLocation, \"Too many arguments. Expected at most %s arguments, got %s arguments\", argumentSpecifications.size(), arguments.size());\n            }\n\n            if (argumentSpecifications.isEmpty()) {\n                return new ArgumentsAnalysis(ImmutableMap.of(), ImmutableList.of());\n            }\n\n            boolean argumentsPassedByName = !arguments.isEmpty() && arguments.stream().allMatch(argument -> argument.getName().isPresent());\n            boolean argumentsPassedByPosition = arguments.stream().allMatch(argument -> !argument.getName().isPresent());\n            if (!argumentsPassedByName && !argumentsPassedByPosition) {\n                throw new SemanticException(TABLE_FUNCTION_INVALID_ARGUMENTS, errorLocation, \"All arguments must be passed by name or all must be passed positionally\");\n            }\n\n            if (argumentsPassedByName) {\n                return mapTableFunctionsArgsByName(argumentSpecifications, arguments, errorLocation, scope);\n            }\n            else {\n                return mapTableFunctionArgsByPosition(argumentSpecifications, arguments, errorLocation, scope);\n            }","sourceCodeStart":1923,"sourceCodeEnd":1959,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java#L1923-L1959","documentation":"Analysis error for a table function invocation: more arguments were passed than the function accepts. The %s pair gives the maximum expected arity and the actual argument count; non-function arguments and descriptor arguments all count toward the total.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:1941 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the extra arguments to match the declared signature","Check the table function's documentation for its exact argument list","Pass values in a single row/struct argument if grouping is needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}