CoplayDev/unity-mcp · error · Exception
edgeIndices or edges parameter is required.
Error message
edgeIndices or edges parameter is required.
What it means
Thrown by ResolveEdges when neither 'edgeIndices'/'edge_indices' nor 'edges' parameter is provided. The edge resolution logic requires at least one of these: an array of integer indices into the unique edge list, or an array of {a, b} vertex-pair objects.
Source
Thrown at MCPForUnity/Editor/Tools/ProBuilder/ManageProBuilder.cs:524
int b = pair["b"]?.Value<int>() ?? 0;
edgeList.Add(CreateEdge(a, b));
}
}
else if (edgeIndicesToken != null)
{
// Edge specification by index into unique edges
var allEdges = CollectUniqueEdges(pbMesh);
var edgeIndices = edgeIndicesToken.ToObject<int[]>();
foreach (int idx in edgeIndices)
{
if (idx < 0 || idx >= allEdges.Count)
throw new Exception($"Edge index {idx} out of range (0-{allEdges.Count - 1}).");
edgeList.Add(allEdges[idx]);
}
}
else
{
throw new Exception("edgeIndices or edges parameter is required.");
}
count = edgeList.Count;
var edgeArray = Array.CreateInstance(_edgeType, edgeList.Count);
for (int i = 0; i < edgeList.Count; i++)
edgeArray.SetValue(edgeList[i], i);
return edgeArray;
}
/// <summary>
/// Create a typed List<Edge> from an Edge[] array for APIs that require IList<Edge>.
/// </summary>
private static System.Collections.IList ToTypedEdgeList(Array edgeArray)
{
var edgeListType = typeof(List<>).MakeGenericType(_edgeType);
var typedList = Activator.CreateInstance(edgeListType) as System.Collections.IList;
foreach (var e in edgeArray)
typedList.Add(e);View on GitHub (pinned to c21bf496bc)
Solutions
- Provide 'edges' as an array of vertex-pair objects: [{"a": 0, "b": 1}, ...].
- Alternatively provide 'edgeIndices' as an array of integers referencing unique edge indices.
- If you need all edges, enumerate them first and build the edgeIndices array from the full set.
- Double-check parameter names: the tool accepts 'edges' or 'edgeIndices'/'edge_indices'.
Example fix
// before
params = {"target": "MyShape", "action": "bevel_edges"}
// after
params = {"target": "MyShape", "action": "bevel_edges", "edges": [{"a": 0, "b": 1}, {"a": 2, "b": 3}]} Defensive patterns
Strategy: validation
Validate before calling
# Ensure at least one edge specification is present before calling
def has_edge_spec(params):
return 'edges' in params or 'edgeIndices' in params or 'edge_indices' in params
if not has_edge_spec(params):
raise ValueError('Provide edges [{a,b},...] or edgeIndices [int,...]') Try / catch
try
{
var edges = ResolveEdges(pbMesh, props, out int count);
}
catch (Exception ex) when (ex.Message == "edgeIndices or edges parameter is required.")
{
return new ErrorResponse("Specify edges as vertex pairs or edgeIndices.");
} Prevention
- Always include edges or edgeIndices in edge-operation calls.
- Use the canonical parameter names: 'edges' or 'edgeIndices'.
- If operating on all edges, enumerate them first and pass the full index set.
When it happens
Trigger: Calling an edge-based ProBuilder operation (e.g. bevel_edges, extrude_edges) without specifying which edges to operate on. The tool has no default 'all edges' behavior for edge operations.
Common situations: AI omits edge parameters assuming the tool will operate on all edges; parameter naming convention mismatch (using 'edge_list' or 'selectedEdges' instead of 'edges' or 'edgeIndices'); empty object passed instead of an array.
Related errors
- Edge index {idx} out of range (0-{allEdges.Count - 1}).
- Face index {indices[i]} out of range (0-{facesList.Count - 1
- Unknown shape type '{shapeTypeStr}'. Valid types: {validType
- 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/3b077b188cb0b962.
Report an issue: GitHub.