Akeyless GetSecret does not return esv1.NoSecretErr when a secret does not exist

Author: wankhede04Created Sep 22, 2026Updated Sep 23, 2026
Labelskind/bugarea/akeyless

Describe the bug

Akeyless.GetSecret (providers/v1/akeyless/akeyless.go) does not translate the provider's own ErrItemNotExists into the esv1.NoSecretErr sentinel. AGENTS.md states the contract directly: "Return esv1.NoSecretErr from GetSecret when the secret is missing. The reconciler depends on this for deletionPolicy." Today GetSecret just returns the raw error, so errors.Is(err, esv1.NoSecretErr) is always false for Akeyless, even though the exact same file's own SecretExists/PushSecret methods already detect this same not-found condition correctly (they call GetSecret internally and check for ErrItemNotExists on its returned error).

To Reproduce

  1. Create a SecretStore/ClusterSecretStore using the Akeyless provider.
  2. Create an ExternalSecret referencing a key that does not exist in the Akeyless vault.
  3. GetSecret returns a plain wrapped error, not esv1.NoSecretErr — any deletionPolicy handling that depends on the sentinel treats this as a generic fetch failure instead of "secret does not exist," per the reconciler contract documented in AGENTS.md.

Minimal reproduction (unit test, passes today against providers/v1/akeyless):

go
func TestAkeylessGetSecret_NotFound(t *testing.T) {
	sm := Akeyless{
		Client: fakeakeyless.New().SetGetSecretFn(func(_ string, _ int32) (string, error) {
			return "", ErrItemNotExists
		}),
	}
	_, err := sm.GetSecret(context.Background(), *makeValidRef())
	if errors.Is(err, esv1.NoSecretErr) {
		t.Fatal("did not expect esv1.NoSecretErr -- reproduces the bug")
	}
}

ESO version: main Provider: Akeyless Expected behavior

GetSecret should return esv1.NoSecretErr when the secret does not exist, matching the pattern this file's own SecretExists/PushSecret already rely on, and matching the same fix already merged for a different provider in #6816 (Keeper Security).

Additional context

Already implemented and tested a fix — happy to open a PR.

Source: external-secrets/external-secrets