{"record":{"id":"2a352933960862d7","repo":"CoplayDev/unity-mcp","slug":"could-not-find-internal-type-unityeditor-logentry","errorCode":null,"errorMessage":"Could not find internal type UnityEditor.LogEntry during GetConsoleEntries.","messagePattern":"Could not find internal type UnityEditor\\.LogEntry during GetConsoleEntries\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"MCPForUnity/Editor/Tools/ReadConsole.cs","lineNumber":263,"sourceCode":"            int resolvedPageSize = Mathf.Clamp(pageSize ?? 50, 1, 500);\n            int resolvedCursor = Mathf.Max(0, cursor ?? 0);\n            int pageEndExclusive = resolvedCursor + resolvedPageSize;\n\n            try\n            {\n                // LogEntries requires calling Start/Stop around GetEntries/GetEntryInternal.\n                // StartGettingEntries() returns the entry count — use it instead of GetCount()\n                // which may return stale values within an active iteration session.\n                object startResult = _startGettingEntriesMethod.Invoke(null, null);\n                int totalEntries = startResult is int startCount\n                    ? startCount\n                    : (int)_getCountMethod.Invoke(null, null);\n                // Create instance to pass to GetEntryInternal - Ensure the type is correct\n                Type logEntryType = typeof(EditorApplication).Assembly.GetType(\n                    \"UnityEditor.LogEntry\"\n                );\n                if (logEntryType == null)\n                    throw new Exception(\n                        \"Could not find internal type UnityEditor.LogEntry during GetConsoleEntries.\"\n                    );\n                object logEntryInstance = Activator.CreateInstance(logEntryType);\n\n                for (int i = 0; i < totalEntries; i++)\n                {\n                    // Get the entry data into our instance using reflection\n                    _getEntryMethod.Invoke(null, new object[] { i, logEntryInstance });\n\n                    // Extract data using reflection\n                    int mode = (int)_modeField.GetValue(logEntryInstance);\n                    string message = (string)_messageField.GetValue(logEntryInstance);\n                    string file = (string)_fileField.GetValue(logEntryInstance);\n\n                    int line = (int)_lineField.GetValue(logEntryInstance);\n\n                    if (string.IsNullOrEmpty(message))\n                    {","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Tools/ReadConsole.cs#L245-L281","documentation":"Thrown by GetConsoleEntries when the internal Unity type 'UnityEditor.LogEntry' cannot be resolved via reflection from the EditorApplication assembly. The console reading pipeline depends on this internal type to instantiate log entry objects for GetEntryInternal. If Unity renames, moves, or removes this internal type, the reflection lookup fails.","triggerScenarios":"Calling read_console on a Unity version where 'UnityEditor.LogEntry' was renamed or moved to a different assembly/namespace. This is an environment/version issue, not a user input error.","commonSituations":"Unity 6.x or a preview/beta version changed internal LogEntry internals; running on a stripped or modified Unity build; the type was split or its accessibility changed.","solutions":["Check if a newer version of MCP for Unity adds support for your Unity version (the LogEntry reflection paths are version-specific).","Report the Unity version to the MCP for Unity maintainers so the reflection cache can be updated.","As a workaround, use Unity's 'clear_console' or rely on log files instead of the console API.","Downgrade or switch to a supported Unity LTS version if console reading is critical."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// C# — pre-check the type exists before the hot path\nType logEntryType = typeof(EditorApplication).Assembly.GetType(\"UnityEditor.LogEntry\");\nif (logEntryType == null)\n    return new ErrorResponse($\"LogEntry type not found in Unity {Application.unityVersion}. Console reading unsupported on this version.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var entries = GetConsoleEntries(pageSize, cursor, ...);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Could not find internal type UnityEditor.LogEntry\"))\n{\n    // Fall back to reading Editor.log or return an unsupported-version message\n    return new ErrorResponse($\"Console reading not supported on Unity {Application.unityVersion}.\");\n}","preventionTips":["Run MCP for Unity on a supported Unity LTS version.","Keep MCP for Unity updated for new Unity versions.","Use Unity's log file as a fallback when the console API is unavailable.","Report unsupported versions to maintainers with the exact Unity version string."],"tags":["console","reflection","internal-api","unity-version","read-console"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}