<p>I have a problem with helm deployment. It has happend after I have added a new environment variable to the deployment.</p>

<p>When I execute: <code>helm upgrade [RELEASE] [CHART]</code> </p>

<p>I get the following error:</p>

<pre><code>Error: The order in patch list:
[
    map[name:APP_ENV value:prod]
    map[name:MAILER_URL value:...] 
    map[name:APP_VERSION value:v0-0-3] 
    map[name:APP_COMMIT_SHA value:...]
]
 doesn't match $setElementOrder list:
[
    map[name:APP_ENV] 
    map[name:COMPOSER_HOME] 
    map[name:PHP_XDEBUG_ENABLED] 
    map[name:DATABASE_DRIVER] 
    map[name:DATABASE_HOST] 
    map[name:DATABASE_NAME] 
    map[name:DATABASE_USER] 
    map[name:SECRET] 
    map[name:INDEX_HOSTS]
    map[name:MAILER_FROM_ADDRESS] 
    map[name:MAILER_FROM_NAME] 
    map[name:UPLOAD_DIR] 
    map[name:ARCHIVE_DIR] 
    map[name:CATALOG_STORAGE_DIR] 
    map[name:ASSET_STORAGE_DIR] 
    map[name:TMP_STORAGE_DIR] 
    map[name:UPLOAD_TMP_DIR] 
    map[name:APP_VERSION] 
    map[name:APP_COMMIT_SHA] 
    map[name:APP_CRON] 
    map[name:DATABASE_PASSWORD] 
    map[name:MAILER_URL]
    ...
]
</code></pre>

<p>However, if I execute the same command with the flag <code>--dry-run</code>, I do not get any error ( <code>helm upgrade [RELEASE] [CHART] --dry-run</code>)</p>

<p>I don't know the reason of this problem or how to solve it</p>

pcampana
<p>I've found that the reason of this problem was that I had some envVars duplicated. In my deployment I had:</p>

<pre><code>...
spec:
  template:
    spec:
      container:
        env:
        - name:  ENV_VAR_NAME
          value: "test"
        - name:  ENV_VAR_NAME
          value: "test"
...
</code></pre>

<p>After removing the duplicated variable:</p>

<pre><code>...
spec:
  template:
    spec:
      container:
        env:
        - name:  ENV_VAR_NAME
          value: "test"
...
</code></pre>

<p>The <code>helm upgrade [RELEASE] [CHART]</code> worked fine</p>
