Troubleshooting Guide¶
Common issues, root causes, and verified resolutions encountered when building, running, and testing synfig-mcp on Windows and Linux.
1. Connection Refused on Bridge Port 19991¶
- Cause: Synfig Studio is not running, or was started without the native bridge patch compiled into the binary.
- Fix:
- Launch the patched
synfigstudio.exe(found inbuild_synfig/build_ucrt64/install/bin/synfigstudio.exeor pre-built releases). - Run
synfig-mcp doctorto verify TCP socket connectivity and configuration. - Alternatively, if no GUI is needed, set
SYNFIG_MCP_BACKEND=headlessto operate via pure-Python SIF DOM manipulation with standalone CLI rendering.
2. MSYS2 Shell /etc/profile Abort (Exit Code 1)¶
- Cause: On Windows systems without a default printer configured in the registry,
/etc/profilereturns exit code 1 when attempting to read the printer configuration. - Fix: In MSYS2 build scripts, invoke
. /etc/profile || truebefore enablingset -e:
3. Stdout Pollution in MCP Clients (JSON-RPC Protocol Parse Errors)¶
- Cause: A Python library or
print()statement wrote unformatted text to standard output, corrupting JSON-RPC framing when running understdiotransport. - Fix:
- All logging in
synfig_mcpusesstructlogdirecting strictly tosys.stderr. - When writing MCP server tools or scripts, never call
print()without redirecting tofile=sys.stderr.
4. Keyframe Interference with Waypoint Interpolation¶
- Cause: When a keyframe exists on the Synfig timeline (e.g. at 1.5s), Synfig's Keyframe engine automatically locks the value at that point to its current static value (e.g.,
(0, 0)), preventing linear interpolation between waypoints placed before and after that keyframe. - Fix:
- Clear unnecessary keyframes via
keyframe.removeoranim.keyframe_deletebefore calculating interpolated waypoint motions across a time span. - Reset the timeline cursor to
0.0safter testing keyframe additions.
5. ValueDescConvert Action Readiness Failure ("Missing time")¶
- Cause: Calling
synfigapp::Action::create("ValueDescConvert")requires setting thetimeparameter (action->set_param("time", cur_time)). Without it,action->is_ready()returnsfalseand Synfig logserror: Missing time, resulting in a request timeout. - Fix: Ensure
action->set_param("time", cur_time)is always passed when converting a ValueNode on an active canvas.
6. Client Container File Access & Path Mapping¶
- Cause: The Synfig MCP server and Synfig Studio execute on the host machine (e.g., Windows), while an MCP client (such as Claude Desktop or Docker runner) may run in an isolated Linux container with paths like
/home/claude/...or/mnt/user-data/.... - Filesystem Paths Read by Bridge:
- The bridge reads files directly from the host filesystem. By default, host files in
~/Documents/SynfigMCP(e.g.C:\Users\<username>\Documents\SynfigMCP) are automatically discovered. - If a file path passed by the client does not exist as-is on the host, the server searches configured workspace roots for the matching filename or relative path.
- Configuring Container Path Mapping:
Set the
SYNFIG_MCP_PATH_MAPPINGenvironment variable before launching the server: Or pass JSON: - Declarative Layer Validation:
In
scene_build,rig_sheet_slice, andscene_auto_build, paths are validated for existence during both dry-run and commit. If a file is missing, the tool returns a structured error identifying the failing layer, the target path, and the resolved host path.
6. Windows NTFS File Permissions (icacls vs chmod)¶
- Cause: POSIX
chmod 600on Windows Python does not modify NTFS Access Control Lists (ACLs), leaving inherited parent folder permissions active and allowing other local accounts access. - Fix:
- The C++ bridge uses native Win32 security APIs (
SetNamedSecurityInfoW) with an explicit DACL containing only the owner SID (GENERIC_ALL) andPROTECTED_DACL_SECURITY_INFORMATIONto strip inheritance. - Verify file permissions using
icacls %USERPROFILE%\.synfig\mcp_token: it must show:(F)with no(I)inheritance flag.
7. Modal GTK Dialog Hang on doc.close¶
- Cause: Calling GTK/Synfig document close on a dirty document triggers an interactive modal dialog asking "Save changes before closing?", blocking the main GTK loop indefinitely in headless or remote MCP operation.
- Fix: The MCP bridge checks
doc->is_dirty()before closing. If dirty, it immediately returns error code1004("Cannot close document with unsaved changes. Call doc.save first or specify force=true.") without spawning a GTK modal dialog.
8. MSYS2 ninja or cmake Not Found in PATH¶
- Cause: Windows PowerShell or standard Command Prompt cannot resolve MSYS2 binaries unless the MSYS2 UCRT64 bin directory is added to the system PATH.
- Fix: Add
C:\msys64\ucrt64\binandC:\msys64\usr\bintoPATH, or invoke Ninja directly usingC:\msys64\ucrt64\bin\ninja.exe.