louislam/uptime-kuma · warning · Error

Please input title

Error message

Please input title

What it means

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.

Source

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

const { checkLogin } = require("../util-server");
const dayjs = require("dayjs");
const { log } = require("../../src/util");
const ImageDataURI = require("../image-data-uri");
const Database = require("../database");
const apicache = require("../modules/apicache");
const StatusPage = require("../model/status_page");
const { UptimeKumaServer } = require("../uptime-kuma-server");
const { Settings } = require("../settings");

/**
 * Validates incident data
 * @param {object} incident - The incident object
 * @returns {void}
 * @throws {Error} If validation fails
 */
function validateIncident(incident) {
    if (!incident.title || incident.title.trim() === "") {
        throw new Error("Please input title");
    }
    if (!incident.content || incident.content.trim() === "") {
        throw new Error("Please input content");
    }
}

/**
 * Socket handlers for status page
 * @param {Socket} socket Socket.io instance to add listeners on
 * @returns {void}
 */
module.exports.statusPageSocketHandler = (socket) => {
    // Post or edit incident
    socket.on("postIncident", async (slug, incident, callback) => {
        try {
            checkLogin(socket);

            let statusPageID = await StatusPage.slugToID(slug);

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Ensure incident.title is a non-empty, non-whitespace string before emitting postIncident.
  2. Disable the submit button until title and content pass client-side validation.
  3. Match the field names the server expects (title, content).

Example fix

// before
socket.emit("postIncident", slug, { title: "   ", content: "x" }, cb);
// after
socket.emit("postIncident", slug, { title: "Outage in EU", content: "Investigating" }, cb);
Defensive patterns

Strategy: validation

Validate before calling

function validIncident(i) {
  return i && typeof i.title === "string" && i.title.trim() !== "";
}
if (!validIncident(incident)) throw new Error("Please input title");
socket.emit("postIncident", slug, incident, cb);

Type guard

function hasIncidentTitle(i) {
  return i != null && typeof i === "object" && typeof i.title === "string" && i.title.trim() !== "";
}

Try / catch

try { await emitAsync("postIncident", slug, incident, cb); }
catch (e) { if (/input title/.test(e.message)) flagField("title"); else throw e; }

Prevention

When it happens

Trigger: Client emits 'postIncident' with an incident object whose title is falsy or trim() === ''. The check fires after checkLogin and slug resolution.

Common situations: Frontend submits the form before the title field is filled; whitespace-only title pasted; field renamed client-side so title is undefined.

Related errors


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