portainer/portainer · error

an error occurred during the SetSecretsIsUsed operation, una

Error message

an error occurred during the SetSecretsIsUsed operation, unable to fetch service accounts. Error: %w

What it means

Error "an error occurred during the SetSecretsIsUsed operation, unable to fetch service accounts. Error: %w" thrown in portainer/portainer.

Source

Thrown at api/kubernetes/cli/secret.go:213

		result.Data = secretDataMap
	}

	return result
}

// SetSecretsIsUsed combines the secrets with the applications that use them.
// the function fetches all the pods and service accounts in the cluster and checks if the secret is used by any of them.
// if the secret is used by a pod or service account, the secret is marked as used.
// otherwise, the secret is returned as is.
func (kcl *KubeClient) SetSecretsIsUsed(secrets *[]models.K8sSecret) error {
	portainerApplicationResources, err := kcl.fetchAllApplicationsListResources("", metav1.ListOptions{})
	if err != nil {
		return fmt.Errorf("an error occurred during the SetSecretsIsUsed operation, unable to fetch Portainer application resources. Error: %w", err)
	}

	serviceAccounts, err := kcl.GetServiceAccounts("")
	if err != nil {
		return fmt.Errorf("an error occurred during the SetSecretsIsUsed operation, unable to fetch service accounts. Error: %w", err)
	}

	for i := range *secrets {
		secret := &(*secrets)[i]

		if isSecretUsedByServiceAccount(*secret, serviceAccounts) {
			secret.IsUsed = true
			continue
		}

		for _, pod := range portainerApplicationResources.Pods {
			if isPodUsingSecret(&pod, *secret) {
				secret.IsUsed = true
				break
			}
		}
	}

View on GitHub (pinned to 17e74456ff)

When it happens

Trigger: Thrown at api/kubernetes/cli/secret.go:213 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of portainer/portainer@17e74456ff (2026-08-26). Data as JSON: /api/errors/ca6449fe849ef3c5. Report an issue: GitHub.