Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
newchannel
Roku Guru

BRIGHTSCRIPT : ERROR : Runtime help needed please

I have a channel that has been operational for a long time. I have been running banner ads on the channel. The banner add url is no longer working and I need to change the url. 

Only because I had to change the bannerad url did I discover that running my earlier channel and current version channel package (which has the new bannerad url) on telnet are giving me the following:

BRIGHTSCRIPT : ERROR : Runtime : For Each Value is Invalid : pkg/soruce/categoryfeed.brs(174)

I checked my catergoryfeed.brs line 174 and it has the following:

for each e in xml.GetBody()


The channel is working perfectly...So any idea what this error is? And, I need to submit the package quickly because it is a subscription channel ie: new package with the updated bannerad url

Would Roku accept such an error so I can submit? Or, will this error not be something they will pass? 

Any help would be appreciated because I have not been able to figure out what is causing the error, especially since there were no errors on the package that was originally submitted and working for a couple years.

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
3 REPLIES 3
RokuKC
Roku Employee
Roku Employee

Re: BRIGHTSCRIPT : ERROR : Runtime help needed please

"newchannel" wrote:

...
BRIGHTSCRIPT : ERROR : Runtime : For Each Value is Invalid : pkg/soruce/categoryfeed.brs(174)

I checked my catergoryfeed.brs line 174 and it has the following:

for each e in xml.GetBody()

...


This error message is alerting you that (according to your example) xml.GetBody() is returning invalid.
Pedantically speaking, BrightScript defines it as a error to pass 'invalid' to the 'for each' statement.

It's a non-fatal error, however, and the purpose of the diagnostic is to help you know that your data processing code is likely not working as expected, e.g. in this case due to invalid XML data or due to a semantic mismatch in the XML structure.

If you think it is working as expected, you could avoid the error message by assigning xml.GetBody() to a local variable and checking for invalid before doing the iteration.

Hope that helps!
0 Kudos
newchannel
Roku Guru

Re: BRIGHTSCRIPT : ERROR : Runtime help needed please

"RokuKC" wrote:
"newchannel" wrote:

...
BRIGHTSCRIPT : ERROR : Runtime : For Each Value is Invalid : pkg/soruce/categoryfeed.brs(174)

I checked my catergoryfeed.brs line 174 and it has the following:

for each e in xml.GetBody()

...


This error message is alerting you that (according to your example) xml.GetBody() is returning invalid.
Pedantically speaking, BrightScript defines it as a error to pass 'invalid' to the 'for each' statement.

It's a non-fatal error, however, and the purpose of the diagnostic is to help you know that your data processing code is likely not working as expected, e.g. in this case due to invalid XML data or due to a semantic mismatch in the XML structure.

If you think it is working as expected, you could avoid the error message by assigning xml.GetBody() to a local variable and checking for invalid before doing the iteration.

Hope that helps!

Thank you. The channel is working perfectly even with the odd error. 
When I submitted the channel originally, there were no errors, so I'm confused why this even shows up. I should be aware of how to do what you suggested but I don't know how. I'll research to try and figure it out. If I am unable to fix the error myself, and channel is working perfectly, is this a type of error that ROKU would not accept the updated package? I changed my banner add url for a different server but everything else is the same and working. 
Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
joetesta
Roku Guru

Re: BRIGHTSCRIPT : ERROR : Runtime help needed please

I should be aware of how to do what you suggested but I don't know how.


This is what he's suggested doing:

xmlBody = xml.GetBody()
if xmlBody <> invalid then
   for each e in xmlBody



That will prevent the error; as far as the cause, you probably have a call returning an empty XML response.
aspiring
0 Kudos