{"record":{"id":"3b077b188cb0b962","repo":"CoplayDev/unity-mcp","slug":"edgeindices-or-edges-parameter-is-required","errorCode":null,"errorMessage":"edgeIndices or edges parameter is required.","messagePattern":"edgeIndices or edges parameter is required\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Tools/ProBuilder/ManageProBuilder.cs","lineNumber":524,"sourceCode":"                    int b = pair[\"b\"]?.Value<int>() ?? 0;\n                    edgeList.Add(CreateEdge(a, b));\n                }\n            }\n            else if (edgeIndicesToken != null)\n            {\n                // Edge specification by index into unique edges\n                var allEdges = CollectUniqueEdges(pbMesh);\n                var edgeIndices = edgeIndicesToken.ToObject<int[]>();\n                foreach (int idx in edgeIndices)\n                {\n                    if (idx < 0 || idx >= allEdges.Count)\n                        throw new Exception($\"Edge index {idx} out of range (0-{allEdges.Count - 1}).\");\n                    edgeList.Add(allEdges[idx]);\n                }\n            }\n            else\n            {\n                throw new Exception(\"edgeIndices or edges parameter is required.\");\n            }\n\n            count = edgeList.Count;\n            var edgeArray = Array.CreateInstance(_edgeType, edgeList.Count);\n            for (int i = 0; i < edgeList.Count; i++)\n                edgeArray.SetValue(edgeList[i], i);\n            return edgeArray;\n        }\n\n        /// <summary>\n        /// Create a typed List&lt;Edge&gt; from an Edge[] array for APIs that require IList&lt;Edge&gt;.\n        /// </summary>\n        private static System.Collections.IList ToTypedEdgeList(Array edgeArray)\n        {\n            var edgeListType = typeof(List<>).MakeGenericType(_edgeType);\n            var typedList = Activator.CreateInstance(edgeListType) as System.Collections.IList;\n            foreach (var e in edgeArray)\n                typedList.Add(e);","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Tools/ProBuilder/ManageProBuilder.cs#L506-L542","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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'."],"exampleFix":"// before\nparams = {\"target\": \"MyShape\", \"action\": \"bevel_edges\"}\n// after\nparams = {\"target\": \"MyShape\", \"action\": \"bevel_edges\", \"edges\": [{\"a\": 0, \"b\": 1}, {\"a\": 2, \"b\": 3}]}","handlingStrategy":"validation","validationCode":"# Ensure at least one edge specification is present before calling\ndef has_edge_spec(params):\n    return 'edges' in params or 'edgeIndices' in params or 'edge_indices' in params\n\nif not has_edge_spec(params):\n    raise ValueError('Provide edges [{a,b},...] or edgeIndices [int,...]')","typeGuard":null,"tryCatchPattern":"try\n{\n    var edges = ResolveEdges(pbMesh, props, out int count);\n}\ncatch (Exception ex) when (ex.Message == \"edgeIndices or edges parameter is required.\")\n{\n    return new ErrorResponse(\"Specify edges as vertex pairs or edgeIndices.\");\n}","preventionTips":["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."],"tags":["probuilder","edges","missing-parameter","validation"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}