getsops/sops · error

cannot create Vault client: %w

Error message

cannot create Vault client: %w

What it means

Error "cannot create Vault client: %w" thrown in getsops/sops.

Source

Thrown at hcvault/keysource.go:415

func vaultClient(address, token string, hc *http.Client) (*api.Client, error) {
	cfg := api.DefaultConfig()
	cfg.Address = address

	allowlist, err := getAllowlist()
	if err != nil {
		return nil, err
	}
	if !allowlist.Allows(address) {
		return nil, fmt.Errorf("Allowlist does not allow %s", address)
	}

	if hc != nil {
		cfg.HttpClient = hc
	}

	client, err := api.NewClient(cfg)
	if err != nil {
		return nil, fmt.Errorf("cannot create Vault client: %w", err)
	}

	if token != "" {
		client.SetToken(token)
	}
	// Provided token takes precedence over the user's token.
	if client.Token() == "" {
		if token, err = userVaultToken(); err != nil {
			return nil, fmt.Errorf("cannot get Vault token: %w", err)
		}
		if token != "" {
			client.SetToken(token)
		}
	}

	return client, nil
}

View on GitHub (pinned to 13442bb981)

When it happens

Trigger: Thrown at hcvault/keysource.go:415 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getsops/sops@13442bb981 (2026-09-01). Data as JSON: /api/errors/b4e170d76127ac25. Report an issue: GitHub.