Skip to content
RustPluginGenerator
CS1501Oxide + Carbon

Fix CS1501: No overload for method takes N arguments (Oxide)

CS1501 means the method exists in the target type but none of its signatures accepts the number of arguments you passed. In Oxide plugins it is almost always an API call with too many or too few parameters, such as ItemManager.CreateByName with four arguments instead of three.

Server console
Error while compiling GiveItems:
[1] No overload for method 'CreateByName' takes 4 arguments at 41:41

Why it happens

C# resolves method calls by name and argument count together. If you call ItemManager.CreateByName("wood", 100, 0, 5) the compiler finds methods named CreateByName but none that take four arguments, so it emits CS1501 instead of a missing-method error (that would be CS1061).

The usual triggers in Rust plugins:

  • Copying a snippet that used a different API shape, or a helper method from another plugin with the same name but different parameters.
  • Passing an extra ulong amount or a BasePlayer that the real signature does not accept.
  • Confusing ItemManager.CreateByName(string shortname, int amount = 1, ulong skin = 0) with ItemManager.CreateByItemID(int itemId, int amount, ulong skin).
  • Optional parameters: CreateByName("wood") is fine because the defaults fill in, but you cannot skip a middle parameter by count alone.
  • Strings used as numbers, e.g. CreateByName("wood", "100", 0) gives CS1503, not CS1501, so check the message column too.

How to fix it

Read the full compiler line in oxide/logs (or the console), note the method name and the reported argument count, then compare against the real signature.

  1. Open the file at the reported line:column. In the example the call is ItemManager.CreateByName("wood", 100, 0, 5) on line 33.
  2. Look up the method on the type it is called on. ItemManager.CreateByName takes (string shortname, int amount = 1, ulong skin = 0), so drop the fourth argument.
  3. If you need a stack count or metadata, do it after creation on the returned Item (item.amount, item.skin) instead of adding parameters to the factory call.
  4. Save the file; Oxide recompiles automatically. Confirm with oxide.reload GiveItems; the console should print Loaded plugin GiveItems v1.0.0 by RustPluginGenerator and no numbered [1] error line.
  5. If the count still seems right, check you are not calling your own overload with a different signature, and that the receiver is the type you think it is.

Before and after

BeforeFails
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("GiveItems", "RustPluginGenerator", "1.0.0")]
    [Description("Gives a configured kit to the player who runs the chat command")]
    public class GiveItems : RustPlugin
    {
        private const string PermUse = "giveitems.use";

        private readonly Dictionary<string, int> kit = new Dictionary<string, int>
        {
            ["wood"] = 500,
            ["stone"] = 500,
            ["metal.fragments"] = 250
        };

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
        }

        [ChatCommand("kit")]
        private void CmdKit(BasePlayer player, string command, string[] args)
        {
            if (player == null)
            {
                return;
            }

            if (!permission.UserHasPermission(player.UserIDString, PermUse))
            {
                SendReply(player, "You do not have permission to use this command.");
                return;
            }

            foreach (KeyValuePair<string, int> entry in kit)
            {
                Item item = ItemManager.CreateByName(entry.Key, entry.Value, 0, 1);
                if (item == null)
                {
                    PrintWarning("Unknown item shortname in kit: " + entry.Key);
                    continue;
                }

                player.GiveItem(item);
            }

            SendReply(player, "Kit delivered.");
        }

        private void Unload()
        {
            // nothing persistent to clean up
        }
    }
}
AfterFixed
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("GiveItems", "RustPluginGenerator", "1.0.0")]
    [Description("Gives a configured kit to the player who runs the chat command")]
    public class GiveItems : RustPlugin
    {
        private const string PermUse = "giveitems.use";

        private readonly Dictionary<string, int> kit = new Dictionary<string, int>
        {
            ["wood"] = 500,
            ["stone"] = 500,
            ["metal.fragments"] = 250
        };

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
        }

        [ChatCommand("kit")]
        private void CmdKit(BasePlayer player, string command, string[] args)
        {
            if (player == null)
            {
                return;
            }

            if (!permission.UserHasPermission(player.UserIDString, PermUse))
            {
                SendReply(player, "You do not have permission to use this command.");
                return;
            }

            foreach (KeyValuePair<string, int> entry in kit)
            {
                Item item = ItemManager.CreateByName(entry.Key, entry.Value, 0);
                if (item == null)
                {
                    PrintWarning("Unknown item shortname in kit: " + entry.Key);
                    continue;
                }

                player.GiveItem(item);
            }

            SendReply(player, "Kit delivered.");
        }

        private void Unload()
        {
            // nothing persistent to clean up
        }
    }
}

FAQ

Why CS1501 and not CS1061?

CS1061 (does not contain a definition) fires when the type has no member with that name at all. CS1501 fires when members with that name exist but no overload matches the arguments you passed, so the name is right and the parameter list is wrong.

Can optional parameters cause this?

No. Optional parameters let you omit trailing arguments, so CreateByName("wood") compiles. You cannot, however, skip a middle parameter by passing fewer arguments in a different order; that produces CS1501 or CS1503 depending on the mismatch.

Does Carbon report this differently?

The compiler code is still CS1501. Carbon prints the compiler message in its own layout with the CS code included, while Oxide prints numbered lines like [1] ... at 33:28 and keeps the full compiler output in oxide/logs.

The plugin is not loaded after saving. Why?

A file that fails to compile is removed from the batch and not loaded; other plugins still compile. Fix the CS1501, save, and check for Loaded plugin GiveItems in the console before testing in game.

Different error?

Paste the full console output and get the cause and a fix in plain English.

Open the error explainer

Skip the debugging

Generated plugins are compiled before you get them, and compiler errors are fixed automatically.

Generate a plugin

2 free plugins a month, no card.

Last updated Oct 26, 2026.

Get plugins that compile first time

Generate