Upload_target not respected

I have 2 microcontrollers of the same type (mapped to /dev/mc_1 and /dev/mc_2 by udev rules).
To specify which controller to upload to I tried the upload_target option in the project configuration. However it seems that the code is just uploaded to the first microcontroller it sees or which ones happen to be powered.
I would expect and error if the upload_target is not present, instead of just silently falling back to picking just any available.
What am I doing wrong or are there other ways to specify which mc to upload to?

Any help appreciated.

What does your platformio.ini look like?

My platform.ini files are as follows:

[env:teensy36]
platform = teensy
board = teensy36
upload_port = /dev/armmc
framework = arduino

; Library options
lib_deps =
  Adafruit Unified Sensor@1.0.2

and the other:

[env:teensy36]
platform = teensy
board = teensy36
upload_port = /dev/basemc
framework = arduino

The name of [env:..] should be unique.

The names are unique in their context. I have two separate projects that live in separate folders on disc. As far as I see there is no connection between them.

Could you share full contents of platformio.ini?