louislam/uptime-kuma · warning · Error

Invalid analytics type

Error message

Invalid analytics type

What it means

Thrown by saveStatusPage when config.analyticsType is not null and not one of the allow-list [google, umami, plausible, matomo, rybbit]. The check guards against storing an unsupported analytics provider into status_page.analytics_type.

Source

Thrown at server/socket-handlers/status-page-socket-handler.js:344

            statusPage.description = config.description;
            statusPage.icon = config.logo;
            ((statusPage.autoRefreshInterval = config.autoRefreshInterval), (statusPage.theme = config.theme));
            //statusPage.published = ;
            //statusPage.search_engine_index = ;
            statusPage.show_tags = config.showTags;
            //statusPage.password = null;
            statusPage.footer_text = config.footerText;
            statusPage.custom_css = config.customCSS;
            statusPage.show_powered_by = config.showPoweredBy;
            statusPage.rss_title = config.rssTitle;
            statusPage.show_only_last_heartbeat = config.showOnlyLastHeartbeat;
            statusPage.show_certificate_expiry = config.showCertificateExpiry;
            statusPage.modified_date = R.isoDateTime();
            statusPage.analytics_id = config.analyticsId;
            statusPage.analytics_script_url = config.analyticsScriptUrl;
            const validAnalyticsTypes = ["google", "umami", "plausible", "matomo", "rybbit"];
            if (config.analyticsType !== null && !validAnalyticsTypes.includes(config.analyticsType)) {
                throw new Error("Invalid analytics type");
            }
            statusPage.analytics_type = config.analyticsType;

            await R.store(statusPage);

            await statusPage.updateDomainNameList(config.domainNameList);
            await StatusPage.loadDomainMappingList();

            // Save Public Group List
            const groupIDList = [];
            let groupOrder = 1;

            for (let group of publicGroupList) {
                let groupBean;
                if (group.id) {
                    groupBean = await R.findOne("group", " id = ? AND public = 1 AND status_page_id = ? ", [
                        group.id,
                        statusPage.id,

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Set config.analyticsType to one of google, umami, plausible, matomo, rybbit, or null.
  2. Update the client dropdown to match the server allow-list exactly.
  3. If you added a new provider, extend validAnalyticsTypes in the same handler and the storage/render paths.

Example fix

// before
config.analyticsType = "ga4";
// after
config.analyticsType = "google";
Defensive patterns

Strategy: validation

Validate before calling

const VALID = ["google", "umami", "plausible", "matomo", "rybbit"];
if (config.analyticsType !== null && !VALID.includes(config.analyticsType)) {
  throw new Error("Invalid analytics type");
}
socket.emit("saveStatusPage", slug, config, imgDataUrl, groups, cb);

Type guard

function isAnalyticsType(v) {
  return v === null || ["google", "umami", "plausible", "matomo", "rybbit"].includes(v);
}

Try / catch

try { await emitAsync("saveStatusPage", slug, config, img, groups, cb); }
catch (e) { if (/Invalid analytics type/.test(e.message)) resetAnalytics(); else throw e; }

Prevention

When it happens

Trigger: Client emits saveStatusPage with config.analyticsType set to an unknown/misspelled provider (or a non-null junk value). null is explicitly allowed (disables analytics).

Common situations: Frontend dropdown adds a provider not yet in the server allow-list; typo in the provider name; older client sending a legacy value removed from the list.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/f9f126f325100bf6. Report an issue: GitHub.