Fix "Unable to find main plugin class" in Oxide/Carbon Rust plugins
Oxide loaded your .cs file but could not find a class it recognizes as the plugin entry point. The class must sit in namespace Oxide.Plugins, derive from RustPlugin (or CovalencePlugin), and match the file name.
Unable to find main plugin class: MyPlugin
Why it happens
Oxide compiles every .cs file in oxide/plugins and then looks for exactly one type that derives from the plugin base class inside the Oxide.Plugins namespace. If it finds none, it prints this loader message and the plugin never appears in oxide.plugins. Common triggers:
- The class inherits from a random type,
object, or nothing at all instead ofRustPlugin. - The file declares
namespace MyServer.Pluginsor has no namespace, so the class is not inOxide.Plugins. - The class name is
Main,Plugin, or something else that does not match the file nameMyPlugin.cs. - The class is
static,abstract, orinternal, so Oxide cannot instantiate it. - The
[Info]attribute was pasted onto the wrong class while the real logic lives in a helper.
Carbon reports the same missing entry point with its own loader output when it loads an Oxide plugin.
How to fix it
- Open
oxide/plugins/MyPlugin.csand check the namespace line. It must benamespace Oxide.Plugins. - Confirm the class derives from
RustPlugin:public class MyPlugin : RustPlugin. - Rename the class so it equals the file name without extension (
MyPlugin.cs->MyPlugin). Case differences also break the match. - Make the class
public, non-static, non-abstract, and the only top-level class in the file. Put helpers in nested classes or in a second file that is not a plugin. - Keep the
[Info]and[Description]attributes on that same class. - Save the file, then run
oxide.reload MyPlugin. A healthy load printsLoaded plugin MyPlugin v1.0.0 by RustPluginGenerator. If the message repeats, runoxide.pluginsand check the file was not renamed toMyPlugin.cs.txtby an editor.
Before and after
using System;
using Newtonsoft.Json;
namespace MyServer.Plugins
{
[Info("MyPlugin", "RustPluginGenerator", "1.0.0")]
[Description("Greets players when they join the server")]
public class MyPlugin
{
private void OnPlayerConnected(BasePlayer player)
{
if (player == null)
return;
player.ChatMessage("Welcome to the server!");
}
}
}using System;
using Newtonsoft.Json;
namespace Oxide.Plugins
{
[Info("MyPlugin", "RustPluginGenerator", "1.0.0")]
[Description("Greets players when they join the server")]
public class MyPlugin : RustPlugin
{
private void OnPlayerConnected(BasePlayer player)
{
if (player == null)
return;
player.ChatMessage("Welcome to the server!");
}
}
}FAQ
Does the class name really have to match the file name?
Yes. Oxide uses the file name to register the plugin, and the main class has to be the one carrying that name. MyPlugin.cs containing class HelperPlugin loads nothing and prints this message. Rename the file or the class so both match.
I have a namespace, but Oxide still can't find the class
The namespace must be exactly Oxide.Plugins. A project-style namespace like MyServer.Oxide.Plugins or a missing namespace both fail. Remove using statements that alias the type and make sure only one class derives from RustPlugin.
Can the plugin use CovalencePlugin instead of RustPlugin?
Yes. CovalencePlugin also lives in Oxide.Plugins and is recognized as an entry point. It is meant for games with the Covalence abstraction; for Rust servers stick with RustPlugin since most Rust APIs are only available there.
The plugin loads in Carbon but not in Oxide
Check folder placement first: oxide/plugins/MyPlugin.cs for Oxide, carbon/plugins/MyPlugin.cs for Carbon. Carbon also accepts plugins without the Oxide.Plugins namespace in some cases, so a file that works there can still fail here. Add the namespace and the base class for Oxide.
Different error?
Paste the full console output and get the cause and a fix in plain English.
Open the error explainerSkip the debugging
Generated plugins are compiled before you get them, and compiler errors are fixed automatically.
Generate a plugin2 free plugins a month, no card.
Last updated Oct 26, 2026.
Get plugins that compile first time
Generate