{"record":{"id":"9199453a2e72b63a","repo":"kestra-io/kestra","slug":"unknown-indent-type-s","errorCode":null,"errorMessage":"Unknown indent type '%s'.","messagePattern":"Unknown indent type '(.+?)'\\.","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/AbstractIndent.java","lineNumber":69,"sourceCode":"            throw new PebbleException(null, String.format(\"The '%s' filter expects an integer as argument 'amount'.\", indentType), lineNumber, self.getName());\n        }\n\n        int amount = ((Long) args.get(\"amount\")).intValue();\n        if (!(amount >= 0)) {\n            throw new PebbleException(null, String.format(\"The '%s' filter expects a positive integer >=0 as argument 'amount'.\", indentType), lineNumber, self.getName());\n        }\n\n        String prefix = prefix(args);\n        String newLine = getLineSeparator(input.toString());\n\n        if (indentType.equals(\"indent\"))\n            // indent filter adds N amount of spaces to each line except for the first one (assuming the first line is already indented in place)\n            return input.toString().replace(newLine, newLine + prefix.repeat(amount));\n        else if (indentType.equals(\"nindent\")) {\n            // nindent filter adds a newline to the string and indents each line by defined amount of spaces\n            return (newLine + input).replace(newLine, newLine + prefix.repeat(amount));\n        }\n        throw new PebbleException(null, String.format(\"Unknown indent type '%s'.\", indentType), lineNumber, self.getName());\n\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":73,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/AbstractIndent.java#L51-L73","documentation":"Thrown by AbstractIndent.abstractApply when the indentType parameter is neither the string 'indent' nor 'nindent'. This is an internal programming error: AbstractIndent is subclassed by IndentFilter (passing 'indent') and NindentFilter (passing 'nindent'), so a user should never see it unless a new subclass is added with a mismatched type string.","triggerScenarios":"A developer extends AbstractIndent and passes an indentType value that is not 'indent' or 'nindent' to abstractApply. This is not reachable through normal Pebble template usage — the type is hardcoded in each filter subclass.","commonSituations":"Contributing a new indentation-related filter to Kestra's Pebble extension set and forgetting to handle the new indentType branch in the if/else-if chain. Refactoring the two existing filters and introducing a typo in the type constant.","solutions":["If subclassing AbstractIndent, ensure the indentType string passed to abstractApply is exactly 'indent' or 'nindent', or extend the if/else-if chain to handle the new type.","Verify the filter subclass constructor passes the correct constant to the parent.","Do not attempt to trigger this via templates; fix the Java subclass code."],"exampleFix":"// before — new subclass with unhandled type\npublic class MyIndentFilter extends AbstractIndent {\n    public Object apply(...) {\n        return abstractApply(input, args, self, context, lineNumber, \"tabs\");\n    }\n}\n\n// after — extend the chain or use an existing type\n    return abstractApply(input, args, self, context, lineNumber, \"indent\");","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// In Java, if subclassing AbstractIndent, validate the indentType before calling abstractApply\nstatic String validateIndentType(String indentType) {\n    return switch (indentType) {\n        case \"indent\", \"nindent\" -> indentType;\n        default -> throw new IllegalArgumentException(\n            \"indentType must be 'indent' or 'nindent', got: \" + indentType);\n    };\n}","tryCatchPattern":null,"preventionTips":["When extending AbstractIndent, only pass 'indent' or 'nindent' as the type string.","Add a unit test for each new subclass that verifies abstractApply does not reach the final throw.","Use an enum for indentType instead of raw strings to prevent mismatches at compile time."],"tags":["pebble","indent-filter","internal","subclassing"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}