{"record":{"id":"f9f126f325100bf6","repo":"louislam/uptime-kuma","slug":"invalid-analytics-type","errorCode":null,"errorMessage":"Invalid analytics type","messagePattern":"Invalid analytics type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/socket-handlers/status-page-socket-handler.js","lineNumber":344,"sourceCode":"            statusPage.description = config.description;\n            statusPage.icon = config.logo;\n            ((statusPage.autoRefreshInterval = config.autoRefreshInterval), (statusPage.theme = config.theme));\n            //statusPage.published = ;\n            //statusPage.search_engine_index = ;\n            statusPage.show_tags = config.showTags;\n            //statusPage.password = null;\n            statusPage.footer_text = config.footerText;\n            statusPage.custom_css = config.customCSS;\n            statusPage.show_powered_by = config.showPoweredBy;\n            statusPage.rss_title = config.rssTitle;\n            statusPage.show_only_last_heartbeat = config.showOnlyLastHeartbeat;\n            statusPage.show_certificate_expiry = config.showCertificateExpiry;\n            statusPage.modified_date = R.isoDateTime();\n            statusPage.analytics_id = config.analyticsId;\n            statusPage.analytics_script_url = config.analyticsScriptUrl;\n            const validAnalyticsTypes = [\"google\", \"umami\", \"plausible\", \"matomo\", \"rybbit\"];\n            if (config.analyticsType !== null && !validAnalyticsTypes.includes(config.analyticsType)) {\n                throw new Error(\"Invalid analytics type\");\n            }\n            statusPage.analytics_type = config.analyticsType;\n\n            await R.store(statusPage);\n\n            await statusPage.updateDomainNameList(config.domainNameList);\n            await StatusPage.loadDomainMappingList();\n\n            // Save Public Group List\n            const groupIDList = [];\n            let groupOrder = 1;\n\n            for (let group of publicGroupList) {\n                let groupBean;\n                if (group.id) {\n                    groupBean = await R.findOne(\"group\", \" id = ? AND public = 1 AND status_page_id = ? \", [\n                        group.id,\n                        statusPage.id,","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/socket-handlers/status-page-socket-handler.js#L326-L362","documentation":"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.","triggerScenarios":"Client emits saveStatusPage with config.analyticsType set to an unknown/misspelled provider (or a non-null junk value). null is explicitly allowed (disables analytics).","commonSituations":"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.","solutions":["Set config.analyticsType to one of google, umami, plausible, matomo, rybbit, or null.","Update the client dropdown to match the server allow-list exactly.","If you added a new provider, extend validAnalyticsTypes in the same handler and the storage/render paths."],"exampleFix":"// before\nconfig.analyticsType = \"ga4\";\n// after\nconfig.analyticsType = \"google\";","handlingStrategy":"validation","validationCode":"const VALID = [\"google\", \"umami\", \"plausible\", \"matomo\", \"rybbit\"];\nif (config.analyticsType !== null && !VALID.includes(config.analyticsType)) {\n  throw new Error(\"Invalid analytics type\");\n}\nsocket.emit(\"saveStatusPage\", slug, config, imgDataUrl, groups, cb);","typeGuard":"function isAnalyticsType(v) {\n  return v === null || [\"google\", \"umami\", \"plausible\", \"matomo\", \"rybbit\"].includes(v);\n}","tryCatchPattern":"try { await emitAsync(\"saveStatusPage\", slug, config, img, groups, cb); }\ncatch (e) { if (/Invalid analytics type/.test(e.message)) resetAnalytics(); else throw e; }","preventionTips":["Bind the dropdown to the exact server allow-list.","Default analyticsType to null when disabled.","Re-validate after upgrading the server (allow-list may grow)."],"tags":["status-page","analytics","validation","allow-list","socket-io"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}