matrix-org / matrix-org/matrix-spec

"Spec" nightly workflow occasionally fails due to `TypeError: Cannot read properties of undefined (reading 'map')`

Open
#2,180 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Tools good first issue
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

The nightly "Spec" workflow failed last night with the following traceback:

> matrix-spec@0.0.1 get-proposals
> node ./scripts/proposals.js

/home/runner/work/matrix-spec/matrix-spec/scripts/proposals.js:201
    const labelsForIssue = issue.labels.map(l => l.name);
                                        ^

TypeError: Cannot read properties of undefined (reading 'map')
    at /home/runner/work/matrix-spec/matrix-spec/scripts/proposals.js:201:41
    at Array.filter (<anonymous>)
    at processIssues (/home/runner/work/matrix-spec/matrix-spec/scripts/proposals.js:200:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.19.3

This is the script in question:

https://github.com/matrix-org/matrix-spec/blob/fb4a0d8f66fb6263786ab7c4de3ef21517fcc64c/scripts/proposals.js#L3-L13

which is used to build the Spec Change Proposals page.

This appears to be only an occasional failure, one that has happened before. Re-running the script manually today yielded success.

From the traceback and the occasional success, my guess is that the GitHub API is occasionally returning the wrong thing. The only impact of this is the spec proposals page getting out of date by a day or two, so fairly low-priority.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in scripts/proposals.js at processIssues around lines 200-201, then inspect the nightly workflow in .github/workflows/main.yml and the linked failed run. Run the proposals script to observe the intermittent behavior. Done means the nightly workflow no longer fails when the API response lacks the expected labels and the proposals page can still be generated.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, github-actions, javascript
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.