dianping/cat · error · Error
prompt requires a title
Error message
prompt requires a title
What it means
bootbox.prompt validates that a title is present before rendering a prompt. Because prompt dialogs have no message field, the title doubles as the prompt's descriptive text ('Please enter your name:'), so an empty or missing title leaves the dialog with no visible question — hence a hard requirement.
Source
Thrown at cat-home/src/main/webapp/assets/js/uncompressed/bootbox.js:436
// we assume that checkboxes are always multiple,
// hence we default to an empty array
value = [];
each(checkedItems, function(_, item) {
value.push($(item).val());
});
break;
}
return options.callback(value);
};
options.show = false;
// prompt specific validation
if (!options.title) {
throw new Error("prompt requires a title");
}
if (!$.isFunction(options.callback)) {
throw new Error("prompt requires a callback");
}
if (!templates.inputs[options.inputType]) {
throw new Error("invalid prompt type");
}
// create the input based on the supplied type
input = $(templates.inputs[options.inputType]);
switch (options.inputType) {
case "text":
case "textarea":
case "email":
case "date":View on GitHub (pinned to e815e74d4c)
Solutions
- Pass the title as the first argument: bootbox.prompt('Enter your name:', function(result){ ... });
- Or use the options form with title: bootbox.prompt({title: 'Enter your name:', callback: fn, value: defaultValue}).
- Default the title when built dynamically: {title: question || 'Enter a value:'}.
Example fix
// before
bootbox.prompt(function (name) { if (name) saveName(name); });
// after
bootbox.prompt('Enter your name:', function (name) { if (name) saveName(name); }); Defensive patterns
Strategy: validation
Validate before calling
bootbox.prompt(question || 'Please enter a value:', callback);
// or options form:
bootbox.prompt({ title: question || 'Enter a value:', callback: callback }); Type guard
function hasPromptTitle(o) {
return !!o && !!o.title;
} Prevention
- prompt's first argument is the title/question
- Default localized titles when i18n keys may be missing
- prompt has no message property — title carries the question
When it happens
Trigger: bootbox.prompt(callback) (forgot the title string); bootbox.prompt({callback: fn}) with no title; title built from a variable that is '' or undefined (empty model field, missing i18n key).
Common situations: Assuming prompt's first argument is the default value or the placeholder; migrating from a different prompt API where the question goes in message; localizing dialogs and the title key is absent for one locale.
Related errors
- prompt requires a callback
- Please specify a message
- confirm requires a callback
- invalid prompt type
- prompt with select requires options
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/761f39a0095a69f7.
Report an issue: GitHub.