Skip to content

server_location stays stuck at null for the rest of the process lifecycle. #535

Description

@mzmrk

** Disclaimer **
Bug report was generated using ChatGPT.
I swear ChatGPT got dumber in last 2 months.
I had to revise this bug report so many times, lol.

Describe the bug
server_location stays stuck at null for the rest of the process lifecycle.

If the bot first stores attributes.location as null, and BattleMetrics later returns a location array, the comparison throws before the new value is saved. Because of that, server_location remains null, and the same error repeats on every scheduled BattleMetrics refresh until the container is restarted.

2026/07/12 12:50:12 | stdout | at async DiscordBot.updateBattlemetricsInstances (/app/src/structures/DiscordBot.js:395:29)
2026/07/12 12:50:12 | stdout | at processTicksAndRejections (node:internal/process/task_queues:95:5)
2026/07/12 12:50:12 | stdout | at Battlemetrics.evaluation (/app/src/structures/Battlemetrics.js:509:38)
2026/07/12 12:50:12 | stdout | at Battlemetrics.#evaluateServerParameter (/app/src/structures/Battlemetrics.js:338:24)
2026/07/12 12:50:12 | stdout | TypeError: Cannot read properties of null (reading 'length')
2026/07/12 12:50:12 | stdout | 2026-7-12 10:50:12 ERROR: Unhandled Rejection: ,TypeError: Cannot read properties of null (reading 'length')

To Reproduce

  1. Start the bot while BattleMetrics returns attributes.location: null.
  2. On a later refresh, have BattleMetrics return attributes.location as an array.
  3. The update throws before saving the array.
  4. server_location remains null, and the same error repeats on every refresh until restart.

Expected behavior
When BattleMetrics changes attributes.location from null to an array, the new value should be saved and future updates should continue normally.

Environment (please complete the following information):
Docker on Synology, docker image with latest image at "master" tag

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions