grafana/k6 · error
invalid key type
Error message
invalid key type
What it means
Error "invalid key type" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/webcrypto/key.go:103
// IsKeyPair .
func (ck *CryptoKey) IsKeyPair() bool {
return false
}
// ResolveCryptoKeyPair returns an error since the underlying type is not a CryptoKeyPair.
func (ck *CryptoKey) ResolveCryptoKeyPair() (*CryptoKeyPair, error) {
return nil, errors.New("not a Crypto Key Pair")
}
// ResolveCryptoKey returns the underlying CryptoKey.
func (ck *CryptoKey) ResolveCryptoKey() (*CryptoKey, error) {
return ck, nil
}
// Validate checks if the key is valid.
func (ck *CryptoKey) Validate() error {
if ck.Type != PrivateCryptoKeyType && ck.Type != PublicCryptoKeyType && ck.Type != SecretCryptoKeyType {
return errors.New("invalid key type")
}
return nil
}
var _ CryptoKeyGenerationResult = &CryptoKey{}
// ContainsUsage returns true if the key contains the specified usage.
func (ck *CryptoKey) ContainsUsage(usage CryptoKeyUsage) bool {
return slices.Contains(ck.Usages, usage)
}
// CryptoKeyType represents the type of a key.
//
// Note that it is defined as an alias of string, instead of a dedicated type,
// to ensure it is handled as a string by sobek.
type CryptoKeyType = string
View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/webcrypto/key.go:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/2f548da846e1f366.
Report an issue: GitHub.