moeru-ai/airi · error · Error

${issue.path.join('.') || '<root>'}: ${issue.message}

Error message

${issue.path.join('.') || '<root>'}: ${issue.message}

What it means

Thrown by parseElectronMcpConfig when the parsed object fails the strict Zod schema electronMcpConfigSchema. The message is a semicolon-delimited list produced by formatElectronMcpConfigIssues, each entry shaped '<dotted.path | <root>>: <zod message>'. The schema requires exactly { mcpServers: Record<string, { command: non-empty string, args?, env?, cwd?, enabled? }> } and is .strict(), so unknown keys and missing/invalid command values are rejected.

Source

Thrown at apps/stage-tamagotchi/src/shared/mcp-config.ts:94

}

/**
 * Parses a plain object into a validated MCP config file.
 *
 * Use when:
 * - JSON text has already been parsed
 * - Main and renderer need one shared validation entrypoint
 *
 * Expects:
 * - `value` is the result of `JSON.parse` or another plain object source
 *
 * Returns:
 * - A validated `ElectronMcpStdioConfigFile`
 */
export function parseElectronMcpConfig(value: unknown): ElectronMcpStdioConfigFile {
  const validated = electronMcpConfigSchema.safeParse(value)
  if (!validated.success) {
    throw new Error(formatElectronMcpConfigIssues(validated.error.issues))
  }

  return validated.data
}

/**
 * Parses JSON text into a validated MCP config file.
 *
 * Use when:
 * - Reading `mcp.json` from disk
 * - Applying raw JSON drafts in the renderer
 *
 * Expects:
 * - `text` contains JSON text for an MCP config file
 *
 * Returns:
 * - A validated `ElectronMcpStdioConfigFile`
 */

View on GitHub (pinned to 27111382b4)

Solutions

  1. Read the full issue list in the thrown message — each 'path: reason' pinpoints the offending field.
  2. Ensure the root has only 'mcpServers' and each server has a non-empty 'command' string.
  3. Remove unknown keys (strict mode) or move them under a permitted optional field.
  4. Validate drafts with electronMcpConfigSchema.safeParse in the settings UI before saving, surfacing issues inline instead of at load time.

Example fix

// before
{ "mcpServers": { "fs": { "args": ["--stdio"] } } }  // missing command -> 'mcpServers.fs.command: Too small'
// after
{ "mcpServers": { "fs": { "command": "npx", "args": ["--stdio"] } } }
Defensive patterns

Strategy: validation

Validate before calling

import { electronMcpConfigSchema } from 'mcp-config'
const result = electronMcpConfigSchema.safeParse(value)
if (!result.success)
  console.error(result.error.issues)  // fix before calling parseElectronMcpConfig

Type guard

function isMcpConfig(value) {
  return electronMcpConfigSchema.safeParse(value).success
}

Try / catch

try {
  const cfg = parseElectronMcpConfig(value)
} catch (e) {
  // e.message is semicolon-delimited 'path: reason' list; surface each to the settings UI
}

Prevention

When it happens

Trigger: Passing an object whose mcpServers entry has an empty or missing command; including unknown top-level keys (strict mode rejects them); nesting servers under a wrong key (e.g. 'servers' instead of 'mcpServers'); providing env as a non Record<string,string>.

Common situations: Hand-editing mcp.json and using a different schema than the Claude/Cursor 'mcpServers' convention; a provider config draft with a typo in the key name; migrating from a looser config format that allowed extra fields; forgetting the command field for a server that only sets args.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/a59d412ca33c0dec. Report an issue: GitHub.