[Bug]: `undefined` error when building in Claude Code
Bug Description
-
Building with XcodeBuildMCP only seems to succeed when there are no errors in the project.
-
When there are errors building the app, Claude Code shows "…: undefined" as the output from XcodeBuildMCP.
-
Additionally, when running
build_ios_sim_name_proj, the** BUILD FAILED **error is visible in Claude Code[DEBUG]output.- but with
build_ios_sim_name_wsnothing shows in Claude Code's debug logs.
Claude Code is failing to recognize the build output in both cases and continues trying a few times before switching to Bash(xcodebuild...) command.
In Claude Code session:
$ claude
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.752Z] [INFO] Sentry disabled due to SENTRY_DISABLED environment variable
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.871Z] [DEBUG] xcodemake is disabled, using standard xcodebuild
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.871Z] [INFO] Server initialized (version 1.4.0)
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.874Z] [INFO] [IDB Setup] Checking idb availability...
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.879Z] [INFO] [IDB Setup] idb is not available, UI automation features will not be available.
[2025-05-22T06:45:26.879Z] [INFO] [IDB Setup] To enable UI automation, see section "Enabling UI Automation" in the README.
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:45:26.884Z] [WARNING] [IDB]: failed to register idb tools as idb is not available
[2025-05-22T06:45:26.884Z] [INFO] XcodeBuildMCP Server running on stdio
[2025-05-22T06:45:26.884Z] [INFO] XcodeBuildMCP server (version 1.4.0) started successfully
> _
> build the app for iPhone 16 with XcodeBuildMCP and fix errors
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:28:10.361Z] [INFO] Starting iOS Simulator build for scheme Abc (internal)
[2025-05-22T06:28:10.361Z] [INFO] Starting iOS Simulator Build build for scheme Abc
[2025-05-22T06:28:10.361Z] [INFO] Executing iOS Simulator Build command: xcodebuild -project "/Users/gurpartap/Projects/abc/Abc.xcodeproj" -scheme "Abc" -configuration Debug -skipMacroValidation -destination "platform=iOS Simulator,name=iPhone 16,OS=latest" build
[2025-05-22T06:28:10.361Z] [DEBUG] DEBUG - Raw command array: ["xcodebuild","-project","/Users/gurpartap/Projects/abc/Abc.xcodeproj","-scheme","Abc","-configuration","Debug","-skipMacroValidation","-destination","platform=iOS Simulator,name=iPhone 16,OS=latest","build"]
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Server stderr: [2025-05-22T06:28:18.452Z] [ERROR] iOS Simulator Build build failed: --- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, arch:arm64, id:EF21AA06-9860-40DF-995C-B4D81A17BFB3, OS:18.4, name:iPhone 16 }
{ platform:iOS Simulator, arch:x86_64, id:EF21AA06-9860-40DF-995C-B4D81A17BFB3, OS:18.4, name:iPhone 16 }
** BUILD FAILED **
...
Building project Abc with scheme Abc and configuration Debug
(24 failures)
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Error calling tool build_ios_sim_name_proj: undefined
⏺ XcodeBuildMCP:build_ios_sim_name_proj (MCP)(projectPath: "/Users/gurpartap/Projects/abc/Abc.xcodeproj",…
scheme: "Abc", simulatorName: "iPhone 16", preferXcodebuild: true)
⎿ Error: Error calling tool build_ios_sim_name_proj: undefined
⏺ XcodeBuildMCP:build_ios_sim_name_ws (MCP)(workspacePath: "/Users/gurpartap/Projects/abc/Abc…
.xcworkspace", scheme: "Abc", simulatorName: "iPhone 16")
⎿ Error: Error calling tool build_ios_sim_name_ws: undefined
In the MCP log files:
[
{
"error": "Server stderr: [2025-05-22T05:37:10.848Z] [INFO] Starting iOS Simulator build for scheme Abc (internal)
[2025-05-22T05:37:10.848Z] [INFO] Starting iOS Simulator Build build for scheme Abc
[2025-05-22T05:37:10.848Z] [INFO] Executing iOS Simulator Build command: xcodebuild -workspace \"/Users/gurpartap/Projects/abc/Abc.xcworkspace\" -scheme \"Abc\" -configuration Debug -skipMacroValidation -destination \"platform=iOS Simulator,name=iPhone 16,OS=latest\" build
[2025-05-22T05:37:10.848Z] [DEBUG] DEBUG - Raw command array: [\"xcodebuild\",\"-workspace\",\"/Users/gurpartap/Projects/abc/Abc.xcworkspace\",\"-scheme\",\"Abc\",\"-configuration\",\"Debug\",\"-skipMacroValidation\",\"-destination\",\"platform=iOS Simulator,name=iPhone 16,OS=latest\",\"build\"]",
"timestamp": "2025-05-22T05:37:10.854Z",
"sessionId": "2322a263-874d-4e1b-979b-4040f0dcc0db",
"cwd": "/Users/gurpartap/Projects/abc"
},
{
"error": "Server stderr: [2025-05-22T05:37:22.911Z] [ERROR] iOS Simulator Build build failed: --- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, arch:arm64, id:EF21AA06-9860-40DF-995C-B4D81A17BFB3, OS:18.4, name:iPhone 16 }
{ platform:iOS Simulator, arch:x86_64, id:EF21AA06-9860-40DF-995C-B4D81A17BFB3, OS:18.4, name:iPhone 16 }
** BUILD FAILED **
The following build commands failed:
SwiftCompile normal arm64 Compiling BunchOfSwiftFiles.swift /Users/gurpartap/Projects/abc/Abc/Dirs With Spaces/MoreSwiftFiles.swift (in target 'Abc' from project 'Abc')
SwiftCompile normal arm64 /Users/gurpartap/Projects/abc/Abc/More Dirs/AndMoreSwiftFiles.swift (in target 'Abc' from project 'Abc')
Building workspace Abc with scheme Abc and configuration Debug
(3 failures)",
"timestamp": "2025-05-22T05:37:22.912Z",
"sessionId": "2322a263-874d-4e1b-979b-4040f0dcc0db",
"cwd": "/Users/gurpartap/Projects/abc"
},
{
"error": "Error calling tool build_ios_sim_name_ws: undefined",
"timestamp": "2025-05-22T05:37:22.913Z",
"sessionId": "2322a263-874d-4e1b-979b-4040f0dcc0db",
"cwd": "/Users/gurpartap/Projects/abc"
}
]
Debug Output
xcodebuildmcp-diagnostic fails to start
[DEBUG] MCP server error: serverName=XcodeBuildMCP, error=Connection failed: MCP error -32000: Connection closed
Editor/Client
Claude Code 0.2.126
MCP Server Version
1.4.0
LLM
Claude 3.7
MCP Configuration
claude mcp add-json XcodeBuildMCP '{
"type": "stdio", "command": "mise",
"args": [
"x",
"npm:[email protected]",
"--",
"xcodebuildmcp"
],
"env": {
"SENTRY_DISABLED": "true"
}
}'
Thanks for reporting! Will take a look.
Getting this same issue on MacOS running Claude Code.
I did some further research into this and it seems its a Bug in Claude Code: https://github.com/anthropics/claude-code/issues/1067
This issue has been fixed with the latest Claude Code update - 1.0.4. Tested this morning.
Thanks for the update, I can also see in my testing everything is working perfect.