New to Kestra?
Use blueprints to kickstart your first workflows.
Enforce integer range bounds and regex string patterns on Kestra flow inputs so bad parameters are rejected before any downstream task executes.
id: regex-input
namespace: company.team
inputs:
- id: age
type: INT
prefill: 42
required: false
min: 18
max: 64
- id: user
type: STRING
prefill: student
required: false
validator: ^student(\d+)?$
tasks:
- id: validator
type: io.kestra.plugin.core.log.Log
message: User {{ inputs.user }}, age {{ inputs.age }}
Bad input is the quietest cause of broken pipelines: a number out of range, a malformed identifier, a typo in a parameter that only surfaces three tasks later. This flow shows how to catch those problems at the front door using Kestra input validators, so a run either starts with clean, well-formed parameters or never starts at all. It pairs a numeric range check with a regular-expression pattern check, the two most common validation needs in real workflows.
The flow declares two typed inputs and a single task that consumes them.
age input is an INT with prefill: 42, min: 18, and max: 64. Kestra rejects any value outside that inclusive range before execution begins.user input is a STRING with prefill: student and a validator set to the regex ^student(\d+)?$. Only strings that match the pattern are accepted.validator task, of type io.kestra.plugin.core.log.Log, logs the validated values with the message User {{ inputs.user }}, age {{ inputs.age }}.The regex breaks down as: ^ start of string, student the literal word, (\d+)? an optional group of one or more digits, and $ end of string. So student and student123 match, while studentabc does not.
min and max on an INT input.validator on a STRING input.prefill so the form is ready to run.Validation lives in declarative YAML right beside the inputs it guards, so the contract is versioned and reviewable. Kestra checks values at submission time across every trigger path: the UI form, the API, a schedule, or an event. Combined with retries, error handlers, and full execution lineage, you get a workflow that refuses garbage parameters and records exactly what it accepted. A bare script or a scheduler that only fires a command cannot enforce typed, range-bound, pattern-matched inputs before execution, which is the gap this pattern fills.
This flow references no secrets.
age and user inputs.age: 30 and user: student7 to see a successful run.age: 70 or user: studentabc to watch validation reject the input.BOOLEAN, DATE, SELECT, JSON) with their own constraints.Log task with real work that depends on the validated parameters.