protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

TypeError: Couldn't build proto file into descriptor pool!

Open dhirschfeld opened this issue 12 years ago • 10 comments

When objects with the same name are defined in two separate .proto files the above error is thrown only when using the C++ backend for Python

dhirschfeld avatar Oct 15 '14 14:10 dhirschfeld

Such name conflict should be reported as an error in every implementation. The pure Python needs to be fixed to report an error as well.

xfxyjwf avatar Oct 15 '14 18:10 xfxyjwf

One problem is that in Python there isn't a central DecriptorPool with all generated types so it can't detect such conflicts. Unless such a DescriptorPool is introduced in Python, pure Python implementation won't be able to detect such conflicts. This also applies to Java.

xfxyjwf avatar Nov 25 '14 00:11 xfxyjwf

hi all,

any update of this issue? I also met this issue.

feiyuw avatar Apr 22 '15 05:04 feiyuw

Hi feiyuw, if you met this issue, the right solution is to get rid of the duplicated messages (by changing the name of one of them).

xfxyjwf avatar Apr 22 '15 20:04 xfxyjwf

hi @xfxyjwf , the proto difinition is included in the to decode file together with protobuf message, and the file format is out of my control, now I use python implementation instead of cpp to work around this problem.

feiyuw avatar Apr 23 '15 02:04 feiyuw

running into this issue too, dropping back to python implementation fixed it.

is the issue really that you can't have objects with the same name in separate .proto files? i have a common practice of defining Request & Response messages in different services and then import them in a common registry.

is the issue just that common registry?

mwildehahn avatar Oct 29 '15 00:10 mwildehahn

I think using the same name for different message types is not a good practice. In your case, you can set different package names on these .proto files and that will avoid the conflict.

xfxyjwf avatar Oct 29 '15 00:10 xfxyjwf

they all have different package names

mwildehahn avatar Oct 29 '15 00:10 mwildehahn

If they all have different package names, they will not be considered as conflicts. Could you post the content of the .proto files and the exact error message you got?

xfxyjwf avatar Oct 29 '15 01:10 xfxyjwf

@xfxyjwf how u solved this problem

Mubashshira avatar Jun 26 '19 08:06 Mubashshira