BadRequestException: Several matching build types/templates found by name for single value locator 'x64.release'
Answered
I'm playing with the REST API and getting an error but cannot figure out why.
To my query
https://teamcity/app/rest/builds/project:MyProject,buildType:x64.release,branch:master/artifacts/children/
The server says:
Responding with error, status code: 400 (Bad Request). Details: jetbrains.buildServer.server.rest.errors.BadRequestException: Several matching build types/templates found by name for single value locator 'x64.release'. Try another locator Invalid request. Please check the request URL and data are correct.
I've tried different dimensions and they mostly work, but as soon as I append buildType:x64.release it stops working and return the error.
Ideas?
Please sign in to leave a comment.
Hello Kirill,

The locator as it`s written above will expect that you do provide a build configuration ID as a buildType:<value>. x64.release is not a valid ID (as it contains a dot which is not allowed for an ID value), so I suppose x64.release relates to something else. Could you please confirm what operation you aim to do, so I will assist further?
As a minimal example, I have done the below request (build was done on ChainProject_A build configuration which belongs to ChainProject project):
Hi Fedor,
Right, my bad. I didn't read
buildTypeLocator
spec properly. According to the spec it should be either id:<configuration_id> or name:<configuration_name>. I missed that.Note however, if I use https://teamcity/app/rest/builds/project:MyProject,buildType:x86.release,branch:master/artifacts/children/ it works and I get a list of x86.release artifacts. e.g. for one configuration (x86.release) it works without name prefix but for the other (x64.release) it doesn't. Seems like a bug-feature to me.
Thanks for the help anyway, I updated my script to use the explicit 'name:' prefix and everything works fine.
Hello Kirill,
Good to hear, thank you for notice!
Regarding the discrepancy in endpoints behavior; what version of TeamCity do you use? Just done a few tests; first of all, indeed, buids/<locator>/artifacts endpoint will work even with buildType:<buildTypeName>, and secondly, the behavior for the both of them was consistent on 2020.1.
Hi Fedor,
I have TeamCity Professional 2020.1 (build 78475).
Can the reason the issue be the fact that my x64 configuration has a dependency on x86 configuration?
Hello Kirill,
No, the dependency should not affect this particular endpoint output as I could see.
Could I ask you to enable debug-rest logging preset (https://www.jetbrains.com/help/teamcity/teamcity-server-logs.html#TeamCityServerLogs-ChangingLoggingConfiguration), do the request in question and reach out to us via Submit a request form above with the teamcity-rest.log (found at <TeamCity Server>/logs folder)? Maybe I am missing something in my tests.