You are viewing the docs for v1.3, which is not the latest release.
View latest

Breaking Change: kv() Throws an Error When a Key Is Missing

For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

KV function errors on missing key

New default behavior of the KV function

Before Kestra 0.22, the kv() function had the property errorOnMissing set to false by default. It was changed to true to align with the rest of the system — for example, the secret() function throws an error when the secret is missing.

If you want to keep the previous behavior of returning null without an error when attempting to fetch non-existing KV-pairs, use the syntax "{{kv('NON_EXISTING_KV_PAIR', errorOnMissing=false)}}".

Before Kestra 0.22

yamlid: myflow
namespace: company.team

tasks:
  - id: this_will_return_null
    type: io.kestra.plugin.core.log.Log
    message: Hello {{kv('NON_EXISTING_KV_PAIR')}} # Hello

After Kestra 0.22

This flow will fail because the kv() function will throw an error when the key is missing:

yamlid: myflow
namespace: company.team

tasks:
  - id: this_will_fail
    type: io.kestra.plugin.core.log.Log
    message: Hello {{kv('NON_EXISTING_KV_PAIR')}} # Error

To keep the previous behavior, use the errorOnMissing=false syntax:

yamlid: myflow
namespace: company.team

tasks:
  - id: this_will_fail
    type: io.kestra.plugin.core.log.Log
    message: Hello {{kv('NON_EXISTING_KV_PAIR', errorOnMissing=false)}} # Hello