{"record":{"id":"dd295dc437b3f181","repo":"neoclide/coc.nvim","slug":"unexpected-messagedialogkind-this-messagedialog","errorCode":null,"errorMessage":"Unexpected messageDialogKind: ${this.messageDialogKind}","messagePattern":"Unexpected messageDialogKind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/notifications.ts","lineNumber":108,"sourceCode":"    let msgDialogKind = this.messageDialogKind\n    if (this.enableMessageDialog === true) {\n      // maintain backwards compatibility, with the original implementation, set the default message kind to use\n      // notification interface even when action items are present.\n      msgDialogKind = 'notification'\n    }\n    if (items.length > 0) {\n      switch (msgDialogKind) {\n        case 'confirm':\n          return await this.showConfirm(message, items, kind)\n        case 'menu':\n          return await this.showMenuPicker(`Choose an action`, message, `Coc${kind}Float`, items)\n        case 'notification': {\n          let texts = items.map(o => typeof o === 'string' ? o : o.title)\n          let idx = await this.createNotification(kind.toLowerCase() as NotificationKind, message, texts)\n          return items[idx]\n        }\n        default:\n          throw new Error(`Unexpected messageDialogKind: ${this.messageDialogKind}`)\n      }\n    } else {\n      // by default the report kind will be echo, meaning that we still keep backwards compatibility with the original\n      // behavior where the user expects that messages are printed to the echo area, with the added caveat that all\n      // message kinds will go there now, information, warning or error\n      let msgReportKind = this.messageReportKind\n      switch (msgReportKind) {\n        case 'echo': {\n          let msgType: MsgTypes = kind == 'Info' ? 'more' : kind == 'Error' ? 'error' : 'warning'\n          this.echoMessages(message, msgType)\n          break\n        }\n        case 'notification': {\n          await this.createNotification(kind.toLowerCase() as NotificationKind, message, [])\n          break\n        }\n        default:\n          throw new Error(`Unexpected messageReportKind: ${msgReportKind}`)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/core/notifications.ts#L90-L126","documentation":"coc's message display behavior is driven by configured kinds (messageDialogKind / messageReportKind). _showMessage switches on the configured dialog kind ('dialog', 'confirm', 'notification', etc.); an unrecognized value falls through to the default branch and throws, since the config value is outside the supported set.","triggerScenarios":"Setting 'notification.messageDialogKind' (or the equivalent configuration) to a string other than the supported values, e.g. a typo like 'notifcation' or an arbitrary string, then triggering a message display.","commonSituations":"Hand-edited coc-settings.json with an invalid enum value; config migrated from older coc versions where allowed values differed; programmatic configuration setting a wrong literal.","solutions":["Reset the messageDialogKind configuration to a supported value ('dialog', 'confirm', 'notification')","Fix the typo in coc-settings.json or the setting source","Remove the custom setting to fall back to defaults","Validate configuration values at load time in your setup scripts"],"exampleFix":"// before (coc-settings.json)\n\"notification.messageDialogKind\": \"popups\"\n// after\n\"notification.messageDialogKind\": \"notification\"","handlingStrategy":"validation","validationCode":"const allowed = ['dialog','confirm','notification']\nconst kind = config.notification?.messageDialogKind\nif (kind && !allowed.includes(kind)) throw new Error(`messageDialogKind must be one of ${allowed}`)","typeGuard":"const isDialogKind = (v): v is 'dialog'|'confirm'|'notification' =>\n  v === 'dialog' || v === 'confirm' || v === 'notification'","tryCatchPattern":"try {\n  await notifications.showMessage('error', msg)\n} catch (e) {\n  if (String(e.message).includes('messageDialogKind')) notify(`Fix notification.messageDialogKind in your settings`)\n  else throw e\n}","preventionTips":["Only set notification.messageDialogKind to documented enum values","Validate coc-settings.json after hand edits","Watch for config schema changes when upgrading coc.nvim"],"tags":["configuration","notifications","invalid-enum"],"backgroundTag":"invalid-config-value","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}