neoclide/coc.nvim · error
Unexpected messageReportKind: ${msgReportKind}
Error message
Unexpected messageReportKind: ${msgReportKind} What it means
_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.
Source
Thrown at src/core/notifications.ts:126
throw new Error(`Unexpected messageDialogKind: ${this.messageDialogKind}`)
}
} else {
// by default the report kind will be echo, meaning that we still keep backwards compatibility with the original
// behavior where the user expects that messages are printed to the echo area, with the added caveat that all
// message kinds will go there now, information, warning or error
let msgReportKind = this.messageReportKind
switch (msgReportKind) {
case 'echo': {
let msgType: MsgTypes = kind == 'Info' ? 'more' : kind == 'Error' ? 'error' : 'warning'
this.echoMessages(message, msgType)
break
}
case 'notification': {
await this.createNotification(kind.toLowerCase() as NotificationKind, message, [])
break
}
default:
throw new Error(`Unexpected messageReportKind: ${msgReportKind}`)
}
return undefined
}
}
public get history(): NotificationItem[] {
return this._history
}
public clearHistory(): void {
this._history = []
}
public createNotification(kind: NotificationKind, message: string, items: string[]): Promise<number> {
return new Promise((resolve, reject) => {
let config: NotificationConfig = {
kind,
content: message,View on GitHub (pinned to 50e974d969)
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.
Example fix
// before let kind = 'Notification' await nvim.showMesage(kind) // hits default, throws // after let kind = 'notification' // supported: 'echo' | 'notification' await this.showMesssageAs(kind, message)
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = ['echo', 'notification']
if (!SUPPORTED.includes(msgReportKind)) throw new Error(`Unsupported messageReportKind: ${msgReportKind}`) Type guard
function isMessageReportKind(v: unknown): v is 'echo' | 'notification' {
return v === 'echo' || v === 'notification'
} Try / catch
try {
await showMessage(kind, message)
} catch (e) {
if (String(e.message).startsWith('Unexpected messageReportKind')) {
logger.warn('falling back to notification')
await showMessage('notification', message)
} else throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unexpected messageDialogKind: ${this.messageDialogKind}
- Required root pattern not resolved.
- coc.nvim requires Node.js VM modules support for ESM extensi
- Unable to load extension at ${extensionRoot}, missing packag
- Unable to load extension at ${filepath}
AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31).
Data as JSON: /api/errors/21dd44b2f69d96e0.
Report an issue: GitHub.