{"record":{"id":"a947e434601ccf6a","repo":"projectdiscovery/nuclei","slug":"failed-to-build-descriptor-source-from-protoset","errorCode":null,"errorMessage":"failed to build descriptor source from protoset: %w","messagePattern":"failed to build descriptor source from protoset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/js/libs/grpc/invoke.go","lineNumber":114,"sourceCode":"\tnoop := func() {}\n\tif strings.TrimSpace(protosetFile) != \"\" {\n\t\t// resolve through the local-file-access allowlist: unless -lfa is set,\n\t\t// only files inside the nuclei-templates directory are permitted.\n\t\tnormalized, err := protocolstate.NormalizePathWithExecutionId(executionID, protosetFile)\n\t\tif err != nil {\n\t\t\treturn nil, noop, fmt.Errorf(\"protoset path denied: %w\", err)\n\t\t}\n\t\tdata, err := os.ReadFile(normalized)\n\t\tif err != nil {\n\t\t\treturn nil, noop, fmt.Errorf(\"failed to read protoset file: %w\", err)\n\t\t}\n\t\tfds := &descriptorpb.FileDescriptorSet{}\n\t\tif err := proto.Unmarshal(data, fds); err != nil {\n\t\t\treturn nil, noop, fmt.Errorf(\"failed to parse protoset file: %w\", err)\n\t\t}\n\t\tsrc, err := grpcurl.DescriptorSourceFromFileDescriptorSet(fds)\n\t\tif err != nil {\n\t\t\treturn nil, noop, fmt.Errorf(\"failed to build descriptor source from protoset: %w\", err)\n\t\t}\n\t\treturn src, noop, nil\n\t}\n\n\trefClient := grpcreflect.NewClientAuto(ctx, cc)\n\tcleanup := func() { refClient.Reset() }\n\treturn grpcurl.DescriptorSourceFromServer(ctx, refClient), cleanup, nil\n}\n\n// invokeUnary invokes a unary (or single-response) gRPC method described by src\n// over cc, marshaling the JSON request and formatting the JSON response.\nfunc invokeUnary(ctx context.Context, src grpcurl.DescriptorSource, cc *grpc.ClientConn, method, requestJSON string, headers []string) (string, error) {\n\tbody := strings.TrimSpace(requestJSON)\n\tif body == \"\" {\n\t\tbody = \"{}\"\n\t}\n\tvar in io.Reader = strings.NewReader(body)\n","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/libs/grpc/invoke.go#L96-L132","documentation":"grpcurl.DescriptorSourceFromFileDescriptorSet rejected the parsed FileDescriptorSet: typically the set does not contain the service/method the template will invoke, or required imported types are missing, so symbol resolution against the set cannot be built and later ListServices/Invoke calls would fail.","triggerScenarios":"Descriptor compiled without --include_imports so transitive message types are absent; invoking 'acme.v1.Svc/Get' while the protoset only defines acme.v2; merging multiple .proto files into one set with conflicting duplicate symbols.","commonSituations":"Protoset generated from a subset of the repo's .proto files; version drift between the descriptor the author compiled and the service actually deployed; renaming services between proto versions.","solutions":["Recompile including imports and every relevant schema: protoc --descriptor_set_out=acme.protoset --include_imports --proto_path=. acme/*.proto","Verify coverage: after Connect(), call ListServices() and check the fully-qualified service name matches the Invoke method string","If the target supports reflection, drop ProtosetFile and let the server provide its own schema"],"exampleFix":"# before: descriptor compiled without imports -> symbols unresolvable\nprotoc --descriptor_set_out=acme.protoset acme.proto\n\n# after: include imports (and all files that define the service)\nprotoc --descriptor_set_out=acme.protoset --include_imports --proto_path=. acme.proto","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const c = new grpc.Client(t, o);\n  c.Connect();\n  const svc = c.ListServices(); // verify the service you plan to Invoke is present\n} catch (e) {\n  if (/descriptor source/.test(e.message || '')) {\n    // recompile protoset with --include_imports, or omit ProtosetFile to use server reflection\n  }\n}","preventionTips":["Always compile protosets with --include_imports and all relevant .proto files","Cross-check the fully-qualified service name via ListServices before Invoke","Keep protoset versions in sync with the deployed service schema"],"tags":["grpc","protobuf","schema"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}