CoplayDev/unity-mcp · critical · Exception
Could not find internal type UnityEditor.LogEntry during Get
Error message
Could not find internal type UnityEditor.LogEntry during GetConsoleEntries.
What it means
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.
Source
Thrown at MCPForUnity/Editor/Tools/ReadConsole.cs:263
int resolvedPageSize = Mathf.Clamp(pageSize ?? 50, 1, 500);
int resolvedCursor = Mathf.Max(0, cursor ?? 0);
int pageEndExclusive = resolvedCursor + resolvedPageSize;
try
{
// LogEntries requires calling Start/Stop around GetEntries/GetEntryInternal.
// StartGettingEntries() returns the entry count — use it instead of GetCount()
// which may return stale values within an active iteration session.
object startResult = _startGettingEntriesMethod.Invoke(null, null);
int totalEntries = startResult is int startCount
? startCount
: (int)_getCountMethod.Invoke(null, null);
// Create instance to pass to GetEntryInternal - Ensure the type is correct
Type logEntryType = typeof(EditorApplication).Assembly.GetType(
"UnityEditor.LogEntry"
);
if (logEntryType == null)
throw new Exception(
"Could not find internal type UnityEditor.LogEntry during GetConsoleEntries."
);
object logEntryInstance = Activator.CreateInstance(logEntryType);
for (int i = 0; i < totalEntries; i++)
{
// Get the entry data into our instance using reflection
_getEntryMethod.Invoke(null, new object[] { i, logEntryInstance });
// Extract data using reflection
int mode = (int)_modeField.GetValue(logEntryInstance);
string message = (string)_messageField.GetValue(logEntryInstance);
string file = (string)_fileField.GetValue(logEntryInstance);
int line = (int)_lineField.GetValue(logEntryInstance);
if (string.IsNullOrEmpty(message))
{View on GitHub (pinned to c21bf496bc)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// C# — pre-check the type exists before the hot path
Type logEntryType = typeof(EditorApplication).Assembly.GetType("UnityEditor.LogEntry");
if (logEntryType == null)
return new ErrorResponse($"LogEntry type not found in Unity {Application.unityVersion}. Console reading unsupported on this version."); Try / catch
try
{
var entries = GetConsoleEntries(pageSize, cursor, ...);
}
catch (Exception ex) when (ex.Message.Contains("Could not find internal type UnityEditor.LogEntry"))
{
// Fall back to reading Editor.log or return an unsupported-version message
return new ErrorResponse($"Console reading not supported on Unity {Application.unityVersion}.");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {hostView.GetType().FullName}.GrabPixels(RenderTexture, Rect
- Failed to resolve Scene view host view.
- Target GameObject not found.
- GameObject '{go.name}' does not have a ProBuilderMesh compon
- Could not read faces from ProBuilderMesh.
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/2a352933960862d7.
Report an issue: GitHub.