{"record":{"id":"78ec4b7672a308a3","repo":"kestra-io/kestra","slug":"the-render-function-expects-an-argument-torende","errorCode":null,"errorMessage":"The 'render' function expects an argument 'toRender'.","messagePattern":"The 'render' function expects an argument 'toRender'\\.","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/RenderFunction.java","lineNumber":58,"sourceCode":"            \"recursive\", \"true\"\n        );\n    }\n\n    @Override\n    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {\n        int depth = context.getVariable(VariableRenderer.RENDER_DEPTH_VAR) instanceof Number n ? n.intValue() : 0;\n        int maxDepth = variableConfiguration.getMaxRenderDepth();\n        if (depth >= maxDepth) {\n            throw new PebbleException(\n                null,\n                \"Maximum render() nesting depth (\" + maxDepth + \") exceeded at line \" + lineNumber +\n                    \" — check for circular render() calls in your template.\",\n                lineNumber, self.getName()\n            );\n        }\n\n        if (!args.containsKey(\"toRender\")) {\n            throw new PebbleException(null, \"The 'render' function expects an argument 'toRender'.\", lineNumber, self.getName());\n        }\n        Object toRender = args.get(\"toRender\");\n\n        Object recursiveArg = args.get(\"recursive\");\n        if (recursiveArg == null) {\n            recursiveArg = true;\n        }\n\n        if (!(recursiveArg instanceof Boolean recursive)) {\n            throw new PebbleException(null, \"The 'render' function expects an optional argument 'recursive' with type boolean.\", lineNumber, self.getName());\n        }\n\n        EvaluationContextImpl evaluationContext = (EvaluationContextImpl) context;\n        Map<String, Object> variables = evaluationContext.getScopeChain().getGlobalScopes().stream()\n            .flatMap(scope -> scope.getKeys().stream())\n            .distinct()\n            .collect(HashMap::new, (m, v) -> m.put(v, context.getVariable(v)), HashMap::putAll);\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/RenderFunction.java#L40-L76","documentation":"The render() function requires at least one named argument 'toRender'. When Pebble resolves the arguments map and the key 'toRender' is absent, the function throws immediately. This happens when the function is invoked with positional syntax, an empty call, or a misspelled argument name.","triggerScenarios":"Calling {{ render() }} with no arguments. Using positional arguments like {{ render(inputs.x) }} instead of named arguments like {{ render(toRender=inputs.x) }}. Misspelling the argument as torender, to_render, or value.","commonSituations":"Copy-pasting from documentation that used shorthand without explaining the named-argument requirement. Auto-completion inserting a wrong argument name. Refactoring an expression and accidentally dropping the argument.","solutions":["Always use the named argument: {{ render(toRender=inputs.myInput) }}.","Verify the argument name is exactly 'toRender' (camelCase).","If using the default argument values from getArgumentDefaults(), ensure the Pebble template passes through the argument explicitly."],"exampleFix":"# before\n{{ render(inputs.x) }}\n\n# after\n{{ render(toRender=inputs.x) }}","handlingStrategy":"validation","validationCode":"# Always include the 'toRender' named argument when calling render().\n# Correct: {{ render(toRender=inputs.x) }}\n# The argument name is case-sensitive: 'toRender' (camelCase).","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use named arguments: render(toRender=...).","Double-check argument names against the function's getArgumentNames() documentation.","Use the Kestra IDE/editor autocomplete to verify argument names."],"tags":["pebble","render","arguments","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}