# Helm Upgrade Failed: \[apiVersion not set, kind not set\]

**URL:** <https://community.replicated.com/t/helm-upgrade-failed-apiversion-not-set-kind-not-set/1602>\
**Category:** Troubleshooting\
**Tags:** helm\
**Created:** [December 15, 2025, 5:24am UTC](https://community.replicated.com/t/helm-upgrade-failed-apiversion-not-set-kind-not-set/1602 "2025-12-15T05:24:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GerardNguyen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/gerardnguyen/32/828_2.png) [@GerardNguyen](https://community.replicated.com/u/GerardNguyen)\
**Post date:** [December 15, 2025, 5:24am UTC](https://community.replicated.com/t/helm-upgrade-failed-apiversion-not-set-kind-not-set/1602/1 "2025-12-15T05:24:10Z")

</div>

## Problem

Your application update may fail to install with the following error:

```auto
Error: UPGRADE FAILED: error validating "": error validating data: [apiVersion not set, kind not set]

```

This error occurs when one or more Helm templates render empty Kubernetes resources with missing `apiVersion` or `kind` fields. This is typically caused by incorrect Helm templating logic, such as conditional blocks that don’t properly handle edge cases.

## Diagnosis Steps

### 1. Reproduce the Issue Locally

First, verify that the error is reproducible outside of the cluster:

```bash
helm template <your-chart> -f values.yaml --validate

```

### 2. Identify Empty Resources

Use `yq` to filter and locate resources with missing required fields:

```bash
helm template <your-chart> -f values.yaml | yq 'select(.apiVersion == null or .kind == null) | {"index": document_index, "content": .}'

```

This command identifies any resources missing `apiVersion` or `kind` and returns their document index within the rendered template output.

**Example output:**

```yaml
---
index: 331
content:
  # commented content

```

If this command returns data, you’ve confirmed the issue and identified the location of the problematic resource.

### 3. Locate the Source Template

Use the document index to examine surrounding resources and identify the source template:

```bash
helm template <your-chart> -f values.yaml | yq 'select(document_index == 332)'

```

**Example output:**

```yaml
# Source: charts/.../templates/resource.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: example-cert

```

The `# Source:` comment indicates which template file is generating the resources near the problematic index.

### 4. Review the Full Template Output

For a complete view of all rendered resources:

```bash
helm template <your-chart> -f values.yaml | less

```

Use this to navigate through the output and examine the context around the problematic resource.

## Resolution

Navigate to the identified template file (e.g., `charts/.../templates/resource.yaml`) and review the templating logic. Common causes include:

- **Conditional blocks** (`{{- if ... }}`) that can result in empty YAML documents
- **Missing template guards** around optional resources
- **Incorrect indentation** in template conditionals

Fix the template logic to ensure resources are either properly rendered with all required fields or completely omitted when conditions aren’t met.

After making corrections, verify the fix by re-running the validation:

```bash
helm template <your-chart> -f values.yaml --validate

```

Create another Replicated release and verify that the chart can be upgraded.
