{"record":{"id":"21dd44b2f69d96e0","repo":"neoclide/coc.nvim","slug":"unexpected-messagereportkind-msgreportkind","errorCode":null,"errorMessage":"Unexpected messageReportKind: ${msgReportKind}","messagePattern":"Unexpected messageReportKind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/notifications.ts","lineNumber":126,"sourceCode":"          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}`)\n      }\n      return undefined\n    }\n  }\n\n  public get history(): NotificationItem[] {\n    return this._history\n  }\n\n  public clearHistory(): void {\n    this._history = []\n  }\n\n  public createNotification(kind: NotificationKind, message: string, items: string[]): Promise<number> {\n    return new Promise((resolve, reject) => {\n      let config: NotificationConfig = {\n        kind,\n        content: message,","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/core/notifications.ts#L108-L144","documentation":"_showMessage validates the configured messageReportKind after handling the 'echo' and 'notification' cases. If the runtime value is neither, the switch falls to default and throws. This indicates an unsupported/invalid value for the message report kind setting.","triggerScenarios":"Calling _showMessage (via showMessage) when the messageReportKind-derived kind string is neither 'echo' nor 'notification' (case-sensitive), e.g. a misspelled or unexpected configured value reaches the switch's default branch.","commonSituations":"Users set an invalid value for the message display configuration; new coc.nvim versions introduce a kind that the current branch set doesn't recognize; programmatic callers pass a raw kind string like 'Notification' expecting case-insensitive handling.","solutions":["Check the coc.nvim configuration for messageReportKind-related values and set it to a supported one ('echo' or 'notification').","Upgrade coc.nvim to the latest version so newer kinds are handled.","If you are a contributor, add a case for the new kind in the switch before the default throw."],"exampleFix":"// before\nlet kind = 'Notification'\nawait nvim.showMesage(kind) // hits default, throws\n// after\nlet kind = 'notification' // supported: 'echo' | 'notification'\nawait this.showMesssageAs(kind, message)","handlingStrategy":"validation","validationCode":"const SUPPORTED = ['echo', 'notification']\nif (!SUPPORTED.includes(msgReportKind)) throw new Error(`Unsupported messageReportKind: ${msgReportKind}`)","typeGuard":"function isMessageReportKind(v: unknown): v is 'echo' | 'notification' {\n  return v === 'echo' || v === 'notification'\n}","tryCatchPattern":"try {\n  await showMessage(kind, message)\n} catch (e) {\n  if (String(e.message).startsWith('Unexpected messageReportKind')) {\n    logger.warn('falling back to notification')\n    await showMessage('notification', message)\n  } else throw e\n}","preventionTips":["Only pass 'echo' or 'notification' as message kinds.","Type the kind parameter as a 'echo' | 'notification' union instead of string.","Validate user configuration values against the supported set at startup."],"tags":["configuration","notifications","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}