grafana/k6 · error
invalid tls password value: '%#v', it needs to be a string
Error message
invalid tls password value: '%#v', it needs to be a string
What it means
Raised by parseConnectTLSParam when the optional `password` entry inside the tls object of grpc.Client.connect() params exists but is not a string. The password decrypts an encrypted private key and must be a plain string; any other type fails the assertion.
Solutions
- Pass the key password as a plain string, e.g. tls: { password: 'secret' }
- If the key is unencrypted, omit the password entry
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/grpc/params.go:240 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/3645bd214c88f87d.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/grpc/params.go:240
params.TLS, ok = v.(map[string]any)
if !ok {
return fmt.Errorf("invalid tls value: '%#v', expected (optional) keys: cert, key, password, and cacerts", v)
}
// optional map keys below
if cert, certok := params.TLS["cert"]; certok {
if _, ok = cert.(string); !ok {
return fmt.Errorf("invalid tls cert value: '%#v', it needs to be a PEM formatted string", v)
}
}
if key, keyok := params.TLS["key"]; keyok {
if _, ok = key.(string); !ok {
return fmt.Errorf("invalid tls key value: '%#v', it needs to be a PEM formatted string", v)
}
}
if pass, passok := params.TLS["password"]; passok {
if _, ok = pass.(string); !ok {
return fmt.Errorf("invalid tls password value: '%#v', it needs to be a string", v)
}
}
if cacerts, cacertsok := params.TLS["cacerts"]; cacertsok {
var cacertsArray []any
if cacertsArray, ok = cacerts.([]any); ok {
for _, cacertsArrayEntry := range cacertsArray {
if _, ok = cacertsArrayEntry.(string); !ok {
return fmt.Errorf("invalid tls cacerts value: '%#v',"+
" it needs to be a string or an array of PEM formatted strings", v)
}
}
} else if _, ok = cacerts.(string); !ok {
return fmt.Errorf("invalid tls cacerts value: '%#v',"+
" it needs to be a string or an array of PEM formatted strings", v)
}
}
return nil
}View on GitHub (pinned to 01ffac6f24)