CoplayDev/unity-mcp · error · Exception
Unknown shape type '{shapeTypeStr}'. Valid types: {validType
Error message
Unknown shape type '{shapeTypeStr}'. Valid types: {validTypes} What it means
Thrown by CreateShapeGeneric when the 'shapeType' string cannot be parsed against the ProBuilder ShapeType enum (Unity.ProBuilder.ShapeType) via Enum.Parse with case-insensitive matching. Valid types include: Cube, Cylinder, Sphere, Plane, Cone, Torus, Pipe, Arch, Stair, CurvedStair, Door, Prism.
Source
Thrown at MCPForUnity/Editor/Tools/ProBuilder/ManageProBuilder.cs:820
new object[] { pivot, totalWidth, totalHeight, ledgeHeight, legWidth, d });
}
default:
return null;
}
}
private static Component CreateShapeGeneric(string shapeTypeStr)
{
object shapeTypeValue;
try
{
shapeTypeValue = Enum.Parse(_shapeTypeEnum, shapeTypeStr, true);
}
catch
{
var validTypes = string.Join(", ", Enum.GetNames(_shapeTypeEnum));
throw new Exception($"Unknown shape type '{shapeTypeStr}'. Valid types: {validTypes}");
}
// Try CreateShape(ShapeType) first
var createMethod = _shapeGeneratorType.GetMethod("CreateShape",
BindingFlags.Static | BindingFlags.Public,
null,
new[] { _shapeTypeEnum },
null);
object[] invokeArgs;
if (createMethod != null)
{
invokeArgs = new[] { shapeTypeValue };
}
else if (_pivotLocationType != null)
{
createMethod = _shapeGeneratorType.GetMethod("CreateShape",
BindingFlags.Static | BindingFlags.Public,View on GitHub (pinned to c21bf496bc)
Solutions
- Use one of the valid ShapeType names: Cube, Cylinder, Sphere, Plane, Cone, Torus, Pipe, Arch, Stair, CurvedStair, Door, Prism.
- If you need a standard primitive, use manage_gameobject create with a primitive type instead.
- Strip whitespace from the shapeType value before sending.
- If a shape type from documentation is rejected, verify your ProBuilder package version supports that enum value.
Example fix
// before
params = {"action": "create", "shapeType": "Box"}
// after
params = {"action": "create", "shapeType": "Cube"} Defensive patterns
Strategy: validation
Validate before calling
VALID_SHAPE_TYPES = {
'Cube', 'Cylinder', 'Sphere', 'Plane', 'Cone', 'Torus',
'Pipe', 'Arch', 'Stair', 'CurvedStair', 'Door', 'Prism'
}
def validate_shape_type(shape_type: str) -> bool:
return shape_type in VALID_SHAPE_TYPES Try / catch
try
{
var shape = CreateShapeGeneric(shapeTypeStr);
}
catch (Exception ex) when (ex.Message.Contains("Unknown shape type"))
{
return new ErrorResponse(ex.Message); // message includes valid types
} Prevention
- Use the exact ProBuilder ShapeType enum names, not standard Unity primitive names.
- Check the tool's documentation or class header comment for the valid type list.
- Case-insensitive matching is supported but the name must still be correct.
- Avoid names like 'Box', 'Capsule', or 'Quad' which are Unity primitives, not ProBuilder shapes.
When it happens
Trigger: Calling create_shape with a shapeType value not in the ShapeType enum. Typo, wrong casing that still fails (though matching is case-insensitive), or using a non-ProBuilder shape name like 'Box', 'Capsule', or 'Quad'.
Common situations: AI uses standard Unity primitive names (Box, Capsule) instead of ProBuilder names; different ProBuilder version exposes a different enum set; typo or trailing whitespace in the shape type.
Related errors
- Face index {indices[i]} out of range (0-{facesList.Count - 1
- Edge index {idx} out of range (0-{allEdges.Count - 1}).
- edgeIndices or edges parameter is required.
- Color array must have 3 or 4 elements.
- Port must be positive.
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/bce47df8bbaf7d03.
Report an issue: GitHub.