If I recall correctly, the function that device:try_create_device(...)
method is calling under the hood should retrieve an error message as second return value, e.g.:
local _, err_message = device:try_create_device(metadata)
And I think that debugging is even more effective if you use Lua’s error handling methods, e.g.:
local _, err_message = pcall(device.try_create_device, device, metadata)
Note: you might find useful this thread.