grafana/k6 · error

input isn't a valid ECDH key

Error message

input isn't a valid ECDH key

What it means

Error "input isn't a valid ECDH key" thrown in grafana/k6.

Source

Thrown at internal/js/modules/k6/webcrypto/jwk.go:291

	}

	switch key := key.(type) {
	case *ecdsa.PrivateKey:
		ecdhKey, err := key.ECDH()
		if err != nil {
			return nil, UnknownCryptoKeyType, fmt.Errorf("failed to convert ECDSA key to ECDH key: %w", err)
		}

		return ecdhKey, PrivateCryptoKeyType, nil
	case *ecdsa.PublicKey:
		ecdhKey, err := key.ECDH()
		if err != nil {
			return nil, UnknownCryptoKeyType, fmt.Errorf("failed to convert ECDSA key to ECDH key: %w", err)
		}

		return ecdhKey, PublicCryptoKeyType, nil
	default:
		return nil, UnknownCryptoKeyType, errors.New("input isn't a valid ECDH key")
	}
}

type rsaJWK struct {
	Kty string `json:"kty"`          // Key Type
	N   string `json:"n"`            // Modulus
	E   string `json:"e"`            // Exponent
	D   string `json:"d,omitempty"`  // Private exponent
	P   string `json:"p,omitempty"`  // First prime factor
	Q   string `json:"q,omitempty"`  // Second prime factor
	Dp  string `json:"dp,omitempty"` // Exponent1
	Dq  string `json:"dq,omitempty"` // Exponent2
	Qi  string `json:"qi,omitempty"` // Coefficient
}

func (jwk *rsaJWK) validate() error {
	if jwk.Kty != "RSA" {
		return fmt.Errorf("invalid key type: %s", jwk.Kty)

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/js/modules/k6/webcrypto/jwk.go:291 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/7549d31c2b959262. Report an issue: GitHub.