{"record":{"id":"3c58812270e81129","repo":"louislam/uptime-kuma","slug":"please-input-content","errorCode":null,"errorMessage":"Please input content","messagePattern":"Please input content","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/socket-handlers/status-page-socket-handler.js","lineNumber":23,"sourceCode":"const ImageDataURI = require(\"../image-data-uri\");\nconst Database = require(\"../database\");\nconst apicache = require(\"../modules/apicache\");\nconst StatusPage = require(\"../model/status_page\");\nconst { UptimeKumaServer } = require(\"../uptime-kuma-server\");\nconst { Settings } = require(\"../settings\");\n\n/**\n * Validates incident data\n * @param {object} incident - The incident object\n * @returns {void}\n * @throws {Error} If validation fails\n */\nfunction validateIncident(incident) {\n    if (!incident.title || incident.title.trim() === \"\") {\n        throw new Error(\"Please input title\");\n    }\n    if (!incident.content || incident.content.trim() === \"\") {\n        throw new Error(\"Please input content\");\n    }\n}\n\n/**\n * Socket handlers for status page\n * @param {Socket} socket Socket.io instance to add listeners on\n * @returns {void}\n */\nmodule.exports.statusPageSocketHandler = (socket) => {\n    // Post or edit incident\n    socket.on(\"postIncident\", async (slug, incident, callback) => {\n        try {\n            checkLogin(socket);\n\n            let statusPageID = await StatusPage.slugToID(slug);\n\n            if (!statusPageID) {\n                throw new Error(\"slug is not found\");","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/socket-handlers/status-page-socket-handler.js#L5-L41","documentation":"Thrown by validateIncident when incident.content is missing or whitespace-only, immediately after the title check. It enforces a non-empty body for every incident posted to a status page.","triggerScenarios":"postIncident is emitted with an incident whose title passes but content is falsy or trim() === ''.","commonSituations":"User fills the title but not the message; whitespace-only content; client sends a content field named differently (e.g. 'body', 'text').","solutions":["Provide a non-empty incident.content string before emitting postIncident.","Validate both title and content client-side and block submission otherwise.","Use the exact field name 'content'."],"exampleFix":"// before\nsocket.emit(\"postIncident\", slug, { title: \"Outage\", content: \"\" }, cb);\n// after\nsocket.emit(\"postIncident\", slug, { title: \"Outage\", content: \"Investigating degraded API.\" }, cb);","handlingStrategy":"validation","validationCode":"function validIncidentContent(i) {\n  return i && typeof i.content === \"string\" && i.content.trim() !== \"\";\n}\nif (!validIncidentContent(incident)) throw new Error(\"Please input content\");\nsocket.emit(\"postIncident\", slug, incident, cb);","typeGuard":"function hasIncidentContent(i) {\n  return i != null && typeof i === \"object\" && typeof i.content === \"string\" && i.content.trim() !== \"\";\n}","tryCatchPattern":"try { await emitAsync(\"postIncident\", slug, incident, cb); }\ncatch (e) { if (/input content/.test(e.message)) flagField(\"content\"); else throw e; }","preventionTips":["Require both title and content in the form.","Use the field name 'content' exactly.","Trim content before submission."],"tags":["status-page","incident","validation","socket-io"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}