{"record":{"id":"0f9e2d4da1c19191","repo":"grafana/k6","slug":"couldn-t-unmarshal-protoset-file-s-w","errorCode":null,"errorMessage":"couldn't unmarshal protoset file %s: %w","messagePattern":"couldn't unmarshal protoset file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/client.go","lineNumber":121,"sourceCode":"\tif initEnv == nil {\n\t\treturn nil, errors.New(\"missing init environment\")\n\t}\n\n\tabsFilePath := initEnv.GetAbsFilePath(protosetPath)\n\tfdsetFile, err := initEnv.FileSystems[\"file\"].Open(absFilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't open protoset: %w\", err)\n\t}\n\n\tdefer func() { _ = fdsetFile.Close() }()\n\tfdsetBytes, err := io.ReadAll(fdsetFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't read protoset: %w\", err)\n\t}\n\n\tfdset := &descriptorpb.FileDescriptorSet{}\n\tif err = proto.Unmarshal(fdsetBytes, fdset); err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't unmarshal protoset file %s: %w\", protosetPath, err)\n\t}\n\n\treturn c.convertToMethodInfo(fdset)\n}\n\n// Note: this function was lifted from `lib/options.go`\nfunc decryptPrivateKey(key, password []byte) ([]byte, error) {\n\tblock, _ := pem.Decode(key)\n\tif block == nil {\n\t\treturn nil, errors.New(\"failed to decode PEM key\")\n\t}\n\n\tblockType := block.Type\n\tif blockType == \"ENCRYPTED PRIVATE KEY\" {\n\t\treturn nil, errors.New(\"encrypted pkcs8 formatted key is not supported\")\n\t}\n\t/*\n\t   Even though `DecryptPEMBlock` has been deprecated since 1.16.x it is still","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/grpc/client.go#L103-L139","documentation":"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).","triggerScenarios":"Thrown at internal/js/modules/k6/grpc/client.go:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}