kestra-io/kestra · error · PebbleException
Unknown indent type '%s'.
Error message
Unknown indent type '%s'.
What it means
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.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/AbstractIndent.java:69
throw new PebbleException(null, String.format("The '%s' filter expects an integer as argument 'amount'.", indentType), lineNumber, self.getName());
}
int amount = ((Long) args.get("amount")).intValue();
if (!(amount >= 0)) {
throw new PebbleException(null, String.format("The '%s' filter expects a positive integer >=0 as argument 'amount'.", indentType), lineNumber, self.getName());
}
String prefix = prefix(args);
String newLine = getLineSeparator(input.toString());
if (indentType.equals("indent"))
// indent filter adds N amount of spaces to each line except for the first one (assuming the first line is already indented in place)
return input.toString().replace(newLine, newLine + prefix.repeat(amount));
else if (indentType.equals("nindent")) {
// nindent filter adds a newline to the string and indents each line by defined amount of spaces
return (newLine + input).replace(newLine, newLine + prefix.repeat(amount));
}
throw new PebbleException(null, String.format("Unknown indent type '%s'.", indentType), lineNumber, self.getName());
}
}
View on GitHub (pinned to 823fada927)
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.
Example fix
// before — new subclass with unhandled type
public class MyIndentFilter extends AbstractIndent {
public Object apply(...) {
return abstractApply(input, args, self, context, lineNumber, "tabs");
}
}
// after — extend the chain or use an existing type
return abstractApply(input, args, self, context, lineNumber, "indent"); Defensive patterns
Strategy: type-guard
Type guard
// In Java, if subclassing AbstractIndent, validate the indentType before calling abstractApply
static String validateIndentType(String indentType) {
return switch (indentType) {
case "indent", "nindent" -> indentType;
default -> throw new IllegalArgumentException(
"indentType must be 'indent' or 'nindent', got: " + indentType);
};
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The '%s' filter expects an integer as argument 'amount'.
- The '%s' filter expects a positive integer >=0 as argument '
- Too many rendering attempts
- Cannot concat {} with {}
- Could not perform greater than or equals comparison
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/9199453a2e72b63a.
Report an issue: GitHub.