{"record":{"id":"27c9d30f2898e49f","repo":"multica-ai/multica","slug":"local-server-missing-required-field-command","errorCode":null,"errorMessage":"local server missing required field `command`","messagePattern":"local server missing required field `command`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/pkg/agent/opencode_mcp.go","lineNumber":230,"sourceCode":"\t}\n\tif err := json.Unmarshal(raw, &probe); err != nil {\n\t\treturn nil, wrap(fmt.Errorf(\"parse: %w\", err))\n\t}\n\tvar typeStr string\n\tif probe.Type != nil {\n\t\tif err := json.Unmarshal(*probe.Type, &typeStr); err != nil {\n\t\t\treturn nil, wrap(fmt.Errorf(\"`type` must be a string, got %s\", strings.TrimSpace(string(*probe.Type))))\n\t\t}\n\t}\n\n\tswitch typeStr {\n\tcase \"local\":\n\t\tvar entry opencodeMCPLocal\n\t\tif err := strictDecode(raw, &entry); err != nil {\n\t\t\treturn nil, wrap(err)\n\t\t}\n\t\tif len(entry.Command) == 0 {\n\t\t\treturn nil, wrap(errors.New(\"local server missing required field `command`\"))\n\t\t}\n\t\tif entry.Timeout != nil && *entry.Timeout <= 0 {\n\t\t\treturn nil, wrap(fmt.Errorf(\"`timeout` must be a positive integer, got %d\", *entry.Timeout))\n\t\t}\n\tcase \"remote\":\n\t\tvar entry opencodeMCPRemote\n\t\tif err := strictDecode(raw, &entry); err != nil {\n\t\t\treturn nil, wrap(err)\n\t\t}\n\t\tif entry.URL == \"\" {\n\t\t\treturn nil, wrap(errors.New(\"remote server missing required field `url`\"))\n\t\t}\n\t\tif entry.Timeout != nil && *entry.Timeout <= 0 {\n\t\t\treturn nil, wrap(fmt.Errorf(\"`timeout` must be a positive integer, got %d\", *entry.Timeout))\n\t\t}\n\t\tif len(entry.OAuth) > 0 {\n\t\t\tif err := validateOpenCodeOAuth(entry.OAuth); err != nil {\n\t\t\t\treturn nil, wrap(fmt.Errorf(\"`oauth`: %w\", err))","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/pkg/agent/opencode_mcp.go#L212-L248","documentation":"Returned when a mcp_config entry declares \"type\": \"local\" but its strict-decoded object has an empty or absent `command` field. Local servers in OpenCode's native MCP config are launched from a command argv, so `command` is mandatory. The strict decoder also means unknown fields fail first, so reaching this error means the object decoded cleanly and only `command` is missing.","triggerScenarios":"Setting {\"type\": \"local\"} or {\"type\": \"local\", \"timeout\": 30} with no \"command\" key, or with \"command\": [] (zero-length array), for a named server in mcp_config.","commonSituations":"Authoring a local stdio MCP server entry and forgetting the command argv; using an env-var substitution that expands to empty; migrating a config that stored the command under a different key (e.g. \"cmd\" or \"args\" only).","solutions":["Add the launch argv: \"command\": [\"npx\", \"-y\", \"@modelcontextprotocol/server-foo\"].","Check for typos in the key name (must be exactly `command`) and ensure it is a non-empty array of strings.","Verify no unknown fields like `cmd` are present — strict decoding rejects those with a different error before this check."],"exampleFix":"// before\n\"mcp_config\": { \"fs\": { \"type\": \"local\" } }\n\n// after\n\"mcp_config\": { \"fs\": { \"type\": \"local\", \"command\": [\"npx\", \"-y\", \"@modelcontextprotocol/server-filesystem\", \"/data\"] } }","handlingStrategy":"validation","validationCode":"function validateLocalEntry(e: { type: string; command?: unknown }): string | null {\n  if (e.type === 'local' && (!Array.isArray(e.command) || e.command.length === 0)) {\n    return 'local MCP server requires a non-empty `command` array';\n  }\n  return null;\n}","typeGuard":"function isLocalMCPEntry(e: Record<string, unknown>): e is { type: 'local'; command: string[]; timeout?: number } {\n  return e.type === 'local' && Array.isArray(e.command) && e.command.length > 0 &&\n    e.command.every((c) => typeof c === 'string');\n}","tryCatchPattern":null,"preventionTips":["Use a JSON schema for mcp_config in your editor so missing required fields are flagged before submission.","Smoke-test local server commands manually (npx -y <pkg>) before embedding them in config."],"tags":["config","mcp","validation","opencode","local-server"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}