{"record":{"id":"5c90d5e0aef8790f","repo":"louislam/uptime-kuma","slug":"please-input-title","errorCode":null,"errorMessage":"Please input title","messagePattern":"Please input title","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/socket-handlers/status-page-socket-handler.js","lineNumber":20,"sourceCode":"const { checkLogin } = require(\"../util-server\");\nconst dayjs = require(\"dayjs\");\nconst { log } = require(\"../../src/util\");\nconst 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);","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/socket-handlers/status-page-socket-handler.js#L2-L38","documentation":"Thrown by validateIncident when incident.title is missing or contains only whitespace. validateIncident runs inside the postIncident handler before persisting an incident to a status page, enforcing a non-empty title.","triggerScenarios":"Client emits 'postIncident' with an incident object whose title is falsy or trim() === ''. The check fires after checkLogin and slug resolution.","commonSituations":"Frontend submits the form before the title field is filled; whitespace-only title pasted; field renamed client-side so title is undefined.","solutions":["Ensure incident.title is a non-empty, non-whitespace string before emitting postIncident.","Disable the submit button until title and content pass client-side validation.","Match the field names the server expects (title, content)."],"exampleFix":"// before\nsocket.emit(\"postIncident\", slug, { title: \"   \", content: \"x\" }, cb);\n// after\nsocket.emit(\"postIncident\", slug, { title: \"Outage in EU\", content: \"Investigating\" }, cb);","handlingStrategy":"validation","validationCode":"function validIncident(i) {\n  return i && typeof i.title === \"string\" && i.title.trim() !== \"\";\n}\nif (!validIncident(incident)) throw new Error(\"Please input title\");\nsocket.emit(\"postIncident\", slug, incident, cb);","typeGuard":"function hasIncidentTitle(i) {\n  return i != null && typeof i === \"object\" && typeof i.title === \"string\" && i.title.trim() !== \"\";\n}","tryCatchPattern":"try { await emitAsync(\"postIncident\", slug, incident, cb); }\ncatch (e) { if (/input title/.test(e.message)) flagField(\"title\"); else throw e; }","preventionTips":["Disable submit until title and content are non-empty.","Trim user input before sending.","Use the exact field name 'title'."],"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"}