{"record":{"id":"5aa381ffb64e7cfd","repo":"dianping/cat","slug":"invalid-prompt-type","errorCode":null,"errorMessage":"invalid prompt type","messagePattern":"invalid prompt type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/uncompressed/bootbox.js","lineNumber":444,"sourceCode":"          break;\n      }\n\n      return options.callback(value);\n    };\n\n    options.show = false;\n\n    // prompt specific validation\n    if (!options.title) {\n      throw new Error(\"prompt requires a title\");\n    }\n\n    if (!$.isFunction(options.callback)) {\n      throw new Error(\"prompt requires a callback\");\n    }\n\n    if (!templates.inputs[options.inputType]) {\n      throw new Error(\"invalid prompt type\");\n    }\n\n    // create the input based on the supplied type\n    input = $(templates.inputs[options.inputType]);\n\n    switch (options.inputType) {\n      case \"text\":\n      case \"textarea\":\n      case \"email\":\n      case \"date\":\n      case \"time\":\n      case \"number\":\n      case \"password\":\n        input.val(options.value);\n        break;\n\n      case \"select\":\n        var groups = {};","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/uncompressed/bootbox.js#L426-L462","documentation":"bootbox.prompt only accepts input types for which it ships an HTML template (in this version: text, textarea, email, date, time, number, password, select, and later checkbox). The templates.inputs lookup happens before the input element is created, and an unknown inputType throws 'invalid prompt type'.","triggerScenarios":"bootbox.prompt({title: 'Pick', inputType: 'radio', callback: fn}); inputType: 'color', 'file', 'range', 'datetime-local', or leaving inputType undefined in a version where 'text' is not the default key present in templates.inputs.","commonSituations":"Expecting bootbox to mirror the full HTML5 input type list; version drift — upgrading bootbox changed the supported set (checkbox added in 4.3+, removed/renamed types across versions); typos in the type string ('Text', 'textarea ' with whitespace).","solutions":["Restrict inputType to the types your bundled bootbox version supports — check templates.inputs in the shipped uncompressed/bootbox.js for the authoritative list.","For unsupported types, use bootbox.dialog with custom HTML in the message, or fall back to a plain form.","Normalize the value: inputType: (type || 'text').toLowerCase() — guards against typos and missing defaults."],"exampleFix":"// before\nbootbox.prompt({ title: 'Pick a color', inputType: 'color', callback: fn });\n\n// after\nbootbox.prompt({ title: 'Favorite color', inputType: 'text', value: '#ff0000', callback: fn });","handlingStrategy":"validation","validationCode":"var SUPPORTED = ['text','textarea','email','date','time','number','password','select','checkbox'];\nvar type = (opts.inputType || 'text').toLowerCase();\nif (SUPPORTED.indexOf(type) === -1) type = 'text';\nopts.inputType = type;\nbootbox.prompt(opts);","typeGuard":"function isSupportedInputType(t) {\n  return ['text','textarea','email','date','time','number','password','select','checkbox'].indexOf(t) !== -1;\n}","tryCatchPattern":null,"preventionTips":["Check templates.inputs in the bundled bootbox.js for the exact supported list","Pin the bootbox version — supported types differ across releases","For unsupported input types use bootbox.dialog with custom HTML"],"tags":["bootbox","prompt","input-type","validation","version-drift"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}