> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/input-data-preprocessing.md).

# Handle empty strings in input variables

Harness handles a blank input variable differently depending on whether you run a pipeline with or without an input set. This topic explains the behavior and shows how to use the **Save Blank Fields as Empty String** setting to preserve empty string values consistently during pipeline execution.

***

### What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* How [Harness handles a blank input variable](#how-harness-handles-blank-input-variables) with and without an input set.
* How to [enable Save Blank Fields as Empty String](#enable-the-save-blank-fields-as-empty-string-setting) with the account-level settings.
* How the pipeline behaves [before](#before-enabling-the-setting) and [after](#after-enabling-the-setting) enabling the setting.

***

### How Harness handles blank input variables <a href="#how-harness-handles-blank-input-variables" id="how-harness-handles-blank-input-variables"></a>

Consider the following pipeline:

```yaml
pipeline:
  name: Input_Pipeline
  identifier: Input_Pipeline
  projectIdentifier: test
  orgIdentifier: default
  tags: {}
  stages:
    - stage:
        name: custom
        identifier: custom
        description: ""
        type: Custom
        spec:
          execution:
            steps:
              - step:
                  type: ShellScript
                  name: ShellScript_1
                  identifier: ShellScript_1
                  spec:
                    shell: Bash
                    executionTarget: {}
                    source:
                      type: Inline
                      spec:
                        script: |
                          input_variable=<+pipeline.variables.input_variable>
                          echo "the value is:$input_variable"
                    environmentVariables: []
                    outputVariables: []
                  timeout: 10m
        tags: {}
  variables:
    - name: input_variable
      type: String
      description: ""
      required: false
      value: <+input>

```

This pipeline has an input variable called `input_variable` that you set at runtime. A simple script prints the value of `input_variable` so you can see whether it is passed as an **empty string** or as **null** when you leave it empty.

The pipeline also has an input set where the value of `input_variable` is left empty. For example:

```yaml
inputSet:
  name: input_set
  tags: {}
  identifier: input_set
  orgIdentifier: default
  projectIdentifier: test
  pipeline:
    identifier: Input_Pipeline
    variables:
      - name: input_variable
        type: String
        value: ""
```

***

### Before enabling the setting <a href="#before-enabling-the-setting" id="before-enabling-the-setting"></a>

The two ways of running a pipeline (without an input set and with an input set) behave differently.

#### Run without an input set <a href="#run-without-an-input-set" id="run-without-an-input-set"></a>

If you run the pipeline without an input set and check the execution, you see this output:

<figure><img src="/files/soNydpgobczEcvcQLI0R" alt="Execution output treating input_variable as empty when run without an input set"><figcaption></figcaption></figure>

The output takes the value of `input_variable` as empty, which is expected because you provided an empty value for `input_variable` at runtime.

#### Run with an input set <a href="#run-with-an-input-set" id="run-with-an-input-set"></a>

Now, run the pipeline using the input set `input_set`.

<figure><img src="/files/eWck4bit3t6kLZYlbYfO" alt="Running the pipeline with the input_set input set"><figcaption></figcaption></figure>

If you run the pipeline using an input set and check the execution, you see this output:

<figure><img src="/files/ZGeIjpVqpSrnDtZooVwS" alt="Execution output treating input_variable as null when run with an input set"><figcaption></figcaption></figure>

The output treats `input_variable` as **null** when it is left empty.

Without the setting enabled, a blank value supplied through an input set is treated as `null` instead of an empty string. This difference can affect pipeline execution if downstream logic expects an empty string.

This happens because, when Harness saves an input set with an empty value for an input variable, or runs the pipeline with an input set that has an empty string value, it encodes the value as `<+input>`.

{% hint style="info" %}
`<+input>` is treated as null in Harness.
{% endhint %}

***

### Enable the Save Blank Fields as Empty String setting <a href="#enable-the-save-blank-fields-as-empty-string-setting" id="enable-the-save-blank-fields-as-empty-string-setting"></a>

To preserve blank string values during execution, enable **Save Blank Fields as Empty String**. When enabled, empty string values (`""`) remain unchanged instead of resolving to `null`.

{% hint style="info" %}
This feature depends on the `CDS_ENABLE_RAW_MODE` feature flag. Contact [Harness Support](mailto:support@harness.io) to enable the feature.
{% endhint %}

Enable the following account-level settings to use this feature. Both settings are available under **Account Settings** -> **General** -> **Default Settings** -> **Pipeline**.

* **Show checkbox to Save Blank Fields as Empty String** (`display_raw_mode_setting`): Displays the **Save Blank Fields as Empty String** checkbox when creating input sets, triggers, or running a pipeline. If disabled, the checkbox is hidden and blank fields continue to resolve as `null`.
* **Default Value of Blank Fields Checkbox** (`default_raw_mode_setting_value`): Selects the checkbox by default wherever it is available.

<figure><img src="/files/6a8C4lZK5Hs4P33uHE1r" alt="Save Blank Fields as Empty String account-level settings"><figcaption></figcaption></figure>

{% hint style="info" %}
When Harness saves a blank String field as an empty string (`""`), it treats that empty string as a resolved value. As a result, an expression such as `<+expression.isResolved(<+pipeline.variables.input_variable>)>` returns `true` even when no value was entered.

Harness cannot distinguish an intentionally empty string from a value that was never provided, so it cannot validate against empty strings during execution.

To require an actual value, mark the variable as required instead of depending on an emptiness check. For more information, refer to [Check expression isResolved isUnresolved null replacement](/harness-platform/use-harness-platform/variables-and-expressions/harness-expressions-reference.md#check-expression-isresolved-isunresolved-null-replacement).
{% endhint %}

***

### After enabling the setting <a href="#after-enabling-the-setting" id="after-enabling-the-setting"></a>

This section uses the same example pipeline and input set from [How Harness handles blank input variables](#how-harness-handles-blank-input-variables).

After you enable the settings, a **Save Blank Fields as Empty String** checkbox appears when you create an input set. Select the checkbox and save the input set. This ensures that Harness treats a blank value as an empty string, not null.

<figure><img src="/files/W3MguWigI7ahbT3ft2wT" alt="Save Blank Fields as Empty String checkbox shown while creating an input set"><figcaption></figcaption></figure>

Run the pipeline again to see the change in both ways of running a pipeline.

#### Run without an input set <a href="#run-without-an-input-set" id="run-without-an-input-set"></a>

A direct run (without an input set) already treats a blank input variable as an empty string, so this path is unaffected by the setting.

#### Run with an input set <a href="#run-with-an-input-set" id="run-with-an-input-set"></a>

Now, run the pipeline using the input set `input_set` with the **Save Blank Fields as Empty String** checkbox enabled.

<figure><img src="/files/DJZZys9RUd28SP7wwV2y" alt="Input set with the Save Blank Fields as Empty String checkbox enabled"><figcaption></figcaption></figure>

If you run the pipeline using an input set and check the execution, you see this output:

<figure><img src="/files/HnqmpeSP99fZ1KNhau3e" alt="Execution output treating input_variable as an empty string after enabling the setting"><figcaption></figcaption></figure>

In this case, the output treats `input_variable` as an **empty string** when it is left empty.

The pipeline now treats blank input values consistently as empty strings, regardless of whether you run it directly or through an input set.

***

### Next steps <a href="#next-steps" id="next-steps"></a>

* [Pipeline settings](/harness-platform/use-harness-platform/pipelines/pipeline-settings.md#save-blank-fields-as-empty-string-settings): Review the account-level settings reference.
* [Input sets and overlays](/harness-platform/use-harness-platform/pipelines/input-sets.md): Create reusable sets of runtime input values.
* [Use runtime input](/harness-platform/use-harness-platform/variables-and-expressions/runtime-input-usage.md): Understand how runtime input values are validated.
