louislam/uptime-kuma · warning · Error

Please input content

Error message

Please input content

What it means

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.

Source

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

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);

            if (!statusPageID) {
                throw new Error("slug is not found");

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Provide a non-empty incident.content string before emitting postIncident.
  2. Validate both title and content client-side and block submission otherwise.
  3. Use the exact field name 'content'.

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: postIncident is emitted with an incident whose title passes but content is falsy or trim() === ''.

Common situations: User fills the title but not the message; whitespace-only content; client sends a content field named differently (e.g. 'body', 'text').

Related errors


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