grafana/k6 · error
couldn't unmarshal protoset file
Error message
couldn't unmarshal protoset file %s: %w
What it means
Raised in Client.LoadProtoset when proto.Unmarshal fails to deserialize the read bytes as a FileDescriptorSet — the file exists and is readable but is not a valid protoset (wrong format, corrupt, or a plain .proto source passed by mistake).
Solutions
- Regenerate the file with protoc --descriptor_set_out (plus --include_imports) to produce a real protoset
- Confirm you are passing the compiled descriptor set, not a .proto source file
- Check for transfer corruption of the protoset
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/grpc/client.go:118 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18).
Data as JSON: /api/errors/0f9e2d4da1c19191.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/grpc/client.go:121
if initEnv == nil {
return nil, errors.New("missing init environment")
}
absFilePath := initEnv.GetAbsFilePath(protosetPath)
fdsetFile, err := initEnv.FileSystems["file"].Open(absFilePath)
if err != nil {
return nil, fmt.Errorf("couldn't open protoset: %w", err)
}
defer func() { _ = fdsetFile.Close() }()
fdsetBytes, err := io.ReadAll(fdsetFile)
if err != nil {
return nil, fmt.Errorf("couldn't read protoset: %w", err)
}
fdset := &descriptorpb.FileDescriptorSet{}
if err = proto.Unmarshal(fdsetBytes, fdset); err != nil {
return nil, fmt.Errorf("couldn't unmarshal protoset file %s: %w", protosetPath, err)
}
return c.convertToMethodInfo(fdset)
}
// Note: this function was lifted from `lib/options.go`
func decryptPrivateKey(key, password []byte) ([]byte, error) {
block, _ := pem.Decode(key)
if block == nil {
return nil, errors.New("failed to decode PEM key")
}
blockType := block.Type
if blockType == "ENCRYPTED PRIVATE KEY" {
return nil, errors.New("encrypted pkcs8 formatted key is not supported")
}
/*
Even though `DecryptPEMBlock` has been deprecated since 1.16.x it is stillView on GitHub (pinned to 8d06114777)