Property '0' of undefined

hello guys
I wrote a script to try
name:show
log(’!!!show!!!’);
const now = Date.now();
const id = declare(“DeviceID.ID”, {value: 1}).value[0];
log(’!!!ID:’ + id);
const manu = declare(“DeviceID.Manufacturer”, {value: 1}).value[0];
log(’!!!DeviceID.Manufacturer:’ + manu);
const out = declare(“DeviceID.OUI”, {value: 1}).value[0];
log(’!!!out:’ + out);
let serial = declare(“DeviceID.SerialNumber”, {value: 1});
log(’!!!serial:’ + serial.value[0]);

let version=(declare(“Device.DeviceInfo.SoftwareVersion”,{value:1})).value[0];
log(’!!!version:’ + version);

log(’!!!end!!!’);
But it seems to have an error

Channel has faulted; channel=“show” retries=1 faultCode=“script.TypeError” faultMessage=“Cannot read property ‘0’ of undefined”

how to make it

The wrong place is here
let version=(declare(“Device.DeviceInfo.SoftwareVersion”,{value:1})).value[0];
Once it was successful but awalys wrong!

I’m not sure if it is the cause of the problem, but why do you have the extra parentheses around that? You have:

let version=(declare("Device.DeviceInfo.SoftwareVersion",{value:1})).value[0];

It should be the same as:

let version=declare("Device.DeviceInfo.SoftwareVersion",{value:1}).value[0];

I’ve tried your sentence. Sometimes I can get it, sometimes I can’t

Are the devices that are working and those that are not working similar (ex. the same model router by the same manufacturer) or are they different? There are different TR069 parameter tree standards - depending on the device make and model, you might not always find the software version at Device.DeviceInfo.SoftwareVersion. Some routers may instead use InternetGatewayDevice.DeviceInfo.SoftwareVersion

Thank you for your advice, my device is now directly connected to the host to debug, there is no route forwarding. I’ve tried InternetGatewayDevice.DeviceInfo.SoftwareVersion,It makes the same mistake.The script initially showed errors, but it was able to run for a while, which confused me. You can see my latest post, which has details.