balena.exceptions.AmbiguousDevice

I’m using the Balena Python SDK, version 15.0.2. It looks like I keep getting an error when using the function balena.models.device.service_var.set to set a service variable.

This is the exception:
raise exceptions.AmbiguousDevice(uuid_or_id)
balena.exceptions.AmbiguousDevice

I am however using the full UUID for the device, so I was wondering if I could get some help on this.

Thanks!!

However, I am inputting the full uu

Hello gktl, thanks for getting in contact.

Are you by any chance doing this call with a service name called ‘main’? If this is the case in fact this could be a case of a AmbiguousService (as ‘main’ is also the name of the supervisor container) throwing with a wrong error message.

You could possibly resolve this by passing the service ID rather than the service name, for example,

services = balena.models.service.get_all_by_application('your/fleet_slug')
# find the service you want, this is just an example
service_id = services[0] # or do a filter to find the one with the name you are searching for
# and then finally
balena.models.device.service_var.set(<uuid>, service_id, <key>, <value>)

Please let me know if this helps!

Best,
Otavio

1 Like