Page MenuHomePhabricator

Error: cannot read property 'Symbol.iterator' of undefined
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • When visiting this terbium page in Abstract Wikipedia.
  • It gives you the error:
Reached max retries. Try again later.

"Z500K1": "cannot read property 'Symbol.iterator' of undefined"

  • Which should evaluate and return the same as this call

This is understandably wrong, but should fail with a Z28158 error instead of a Z500

Event Timeline

Jdforrester-WMF changed the task status from Open to In Progress.Apr 7 2026, 3:05 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF triaged this task as Medium priority.

Change #1268967 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-03-31-162258 to 2026-04-07-234729

https://gerrit.wikimedia.org/r/1268967

Change #1268967 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-03-31-162258 to 2026-04-07-234729

https://gerrit.wikimedia.org/r/1268967

Hey @Jdforrester-WMF
Nope
The UI gives me the next error (in red background)

Wikifunctions returned a failed response: Unspecified error

And the undelying API call:

"Z500K1": "cannot read property 'Symbol.iterator' of undefined"

DSantamaria changed the task status from In Progress to Open.Apr 20 2026, 3:56 PM

It looks like the crash might be in Z22979: Z6001K5 is undefined when the input lacks statements. Adding if ( !claims ) { return result; } after line 3 should fix it.

It looks like the crash might be in Z22979: Z6001K5 is undefined when the input lacks statements. Adding if ( !claims ) { return result; } after line 3 should fix it.

The for (const claim of claims ) {…} loop would already be a no-op, though, so this shouldn't change the response? But either way, our server code shouldn't treat this as a fatal in our code. :-)

The for (const claim of claims ) {…} loop would already be a no-op, though, so this shouldn't change the response? But either way, our server code shouldn't treat this as a fatal in our code. :-)

I think the root issue is in WFBuiltinImpl.evaluate() in WFImplementation.js. This method does not catch native JS errors from builtin functors, so a TypeError escapes up and becomes a generic Z507. The fix in MR633 guards only Z8K1, but the same pattern exists in many other builtins, which might explain why @Redmin sees it in Z34050 too.

Catching non-WFException errors at that single point would protect all builtins at once. I was able to reproduce the bug locally and this approach seems to work.

Thanks! That reproduction step is helpful.

The for (const claim of claims ) {…} loop would already be a no-op, though, so this shouldn't change the response? But either way, our server code shouldn't treat this as a fatal in our code. :-)

I think the root issue is in WFBuiltinImpl.evaluate() in WFImplementation.js. This method does not catch native JS errors from builtin functors, so a TypeError escapes up and becomes a generic Z507. The fix in MR633 guards only Z8K1, but the same pattern exists in many other builtins, which might explain why @Redmin sees it in Z34050 too.

Catching non-WFException errors at that single point would protect all builtins at once. I was able to reproduce the bug locally and this approach seems to work.

Yeah, unfortunately I think you're right; we're going to have to catch all these errors blindly and re-throw as Z507s, and rely on warning us in the logs so the devs come and fix the issues in the built-ins one-by-one. I'll do this now.

Change #1297142 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-05-19-223625 to 2026-06-03-020126

https://gerrit.wikimedia.org/r/1297142

Change #1297142 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-05-19-223625 to 2026-06-03-020126

https://gerrit.wikimedia.org/r/1297142

@Jdforrester-WMF I still see the error, is it because it's cached?

DSantamaria changed the task status from Open to In Progress.Jun 17 2026, 5:18 PM