louislam/uptime-kuma · error · Error
Invalid array
Error message
Invalid array
What it means
Thrown by StatusPage.updateDomainNameList(domainNameList) when the argument is not an array. The method deletes all existing CNAME mappings and re-inserts the provided list inside a transaction, so a non-array input would corrupt the iteration.
Source
Thrown at server/model/status_page.js:386
let list = await R.findAll("status_page", " ORDER BY title ");
for (let item of list) {
result[item.id] = await item.toJSON();
}
io.to(socket.userID).emit("statusPageList", result);
return list;
}
/**
* Update list of domain names
* @param {string[]} domainNameList List of status page domains
* @returns {Promise<void>}
*/
async updateDomainNameList(domainNameList) {
if (!Array.isArray(domainNameList)) {
throw new Error("Invalid array");
}
let trx = await R.begin();
await trx.exec("DELETE FROM status_page_cname WHERE status_page_id = ?", [this.id]);
try {
for (let domain of domainNameList) {
if (typeof domain !== "string") {
throw new Error("Invalid domain");
}
if (domain.trim() === "") {
continue;
}
// If the domain name is used in another status page, delete it
await trx.exec("DELETE FROM status_page_cname WHERE domain = ?", [domain]);View on GitHub (pinned to 6b5ea01557)
Solutions
- Pass an array of strings, e.g. ["status.example.com"].
- If you have a single domain, wrap it: Array.isArray(x) ? x : [x].
- For an empty list, pass [] to clear all domains.
Example fix
// before
await statusPage.updateDomainNameList("status.example.com");
// after
await statusPage.updateDomainNameList(["status.example.com"]); Defensive patterns
Strategy: type-guard
Validate before calling
function ensureDomainArray(list) {
if (!Array.isArray(list)) throw new Error("domainNameList must be an array");
return list;
} Type guard
function isDomainNameList(list) {
return Array.isArray(list);
} Try / catch
try {
await statusPage.updateDomainNameList(list);
} catch (e) {
if (/Invalid array/.test(e.message)) return badRequest("domains must be an array");
throw e;
} Prevention
- Wrap single values with [x] at the API boundary.
- Type the field as string[] in your client schema.
When it happens
Trigger: Call updateDomainNameList with a string ("example.com"), an object ({domain: "x"}), null, or undefined. The guard fires before the transaction body iterates.
Common situations: API client sends a single domain string instead of a one-element array. JSON payload where the field was serialized as an object keyed by domain. Status-page import script that forgets to wrap the value in []
Related errors
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/84d16683a12abbc4.
Report an issue: GitHub.