FANDOM


Common Errors and SolutionsEdit

This page will contain a list of the most common errors I can find from people in the wiki chat. -Mitchellex

Certain areas in the code have been bolded and/or italicized for reference. Text will not be formatted as such in the ModPack Builder window.

Cannot Convert 'cast' to 'cast' Error.Edit

This is probably the most encountered error for moderate modders.

Error compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Testing\Item\Cr
ystal Sword.cs
System.Exception: Errors building source code into C:\Users\Name\AppData\Local\Tem
p\nfvi0h2q.dll  c:\Users\Name\AppData\Local\Temp\nfvi0h2q.0.cs(21,6) : error CS013
1: The left-hand side of an assignment must be a variable, property or indexer
c:\Users\Name\AppData\Local\Temp\nfvi0h2q.0.cs(21,6) : error CS0029: Cannot implic
itly convert type 'int' to 'bool'  c:\Users\Name\AppData\Local\Temp\nfvi0h2q.0.cs(
29,7) : error CS0131: The left-hand side of an assignment must be a variable, pr
operty or indexer  c:\Users\Name\AppData\Local\Temp\nfvi0h2q.0.cs(29,7) : error CS
0029: Cannot implicitly convert type 'int' to 'bool'  c:\Users\Name\AppData\Local\
Temp\nfvi0h2q.0.cs(31,4) : error CS0201: Only assignment, call, increment, decre
ment, and new object expressions can be used as a statement
   at Terraria.ModPackBuilder.compilePerm(String className, String sourceFile, S
tring type, Boolean save)
   at Terraria.ModPackBuilder.CompileCSCheck(String className, String codePath,
String type)
Build failed!
Press Enter to continue

Alright, so what does this mean, exactly? Well, the bolded and italicized part is telling you the part of your mod that needs fixing, so it's easy to locate what went wrong.

The bold part is giving you the specific error. To find what the error is, look at 'error CS####'. Once you get enough errors you will become more familiar with specific codes. This error is saying that somewhere in the file, you made an int where a bool should have been.

 player.inventory[player.selectedItem].type == Config.itemDefs.byName["Broken Crystal Sword"].type;

This line is whats causing the error in the file, because == is a term used for a bool. To fix it simply remove one of the equal signs. A more common place this would happen is if you accidentally put

player.lifeRegen = true;

Where lifeRegen is an int but you put a bool in its place.

player.statMana -= (int) 0.05f;

This is another way to fix these errors, telling the code to become a certain cast.

Expected ErrorEdit

This is probably the most encountered error for beginning modders.

Compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater Armor
\Item\Underwater Chest Piece.cs
Error compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater
 Armor\Item\Underwater Chest Piece.cs
System.Exception: Errors building source code into C:\Users\Heather\AppData\Loca
l\Temp\anq4e5g5.dll  c:\Users\Name\AppData\Local\Temp\anq4e5g5.0.cs(18,22) :
error CS1002: ; expected
   at Terraria.ModPackBuilder.compilePerm(String className, String sourceFile, S
tring type, Boolean save)
   at Terraria.ModPackBuilder.CompileCSCheck(String className, String codePath,
String type)
Build failed!
Press Enter to continue

Alright, so what does this mean? Well, the bolded and italicized part is telling you the part of your mod that needs fixing, so it's easy to locate what went wrong.

The bold part is giving you the specific error. To find what the error is, look at 'error CS####'. Once you get enough errors you will become more familiar with specific codes. This error is saying that somewhere in the file, you forgot a semicolon ;

player.lifeRegen += 2

This code is incorrect and will cause an error.

player.lifeRegen += 2;

That is the correct code, and because it is such a small difference, it could be very easily missed (especially in larger segments of code).

Compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater Armor
\Item\Underwater Helm.cs
Error compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater
 Armor\Item\Underwater Helm.cs
System.Exception: Errors building source code into C:\Users\Name\AppData\Loca
l\Temp\uer1mosd.dll  c:\Users\Name\AppData\Local\Temp\uer1mosd.0.cs(20,2) : e
rror CS1513: } expected  c:\Users\Name\AppData\Local\Temp\uer1mosd.0.cs(20,2)
 : error CS1513: } expected
   at Terraria.ModPackBuilder.compilePerm(String className, String sourceFile, S
tring type, Boolean save)
   at Terraria.ModPackBuilder.CompileCSCheck(String className, String codePath,
String type)
Build failed!

This is another form of the error, but in this case it's saying that you missed a } or put too many {. To solve this error, simply look through the .cs file and make sure there are the same amount of closing brackets } as there are starting brackets {.

Terraria Does Not Contain a Definition Error.Edit

This is also a fairly common error.

Compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater Armo
\Item\Underwater Chest Piece.cs
Error compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwate
 Armor\Item\Underwater Chest Piece.cs
System.Exception: Errors building source code into C:\Users\Heather\AppData\Loc
l\Temp\uw1nablx.dll  c:\Users\Name\AppData\Local\Temp\uw1nablx.0.cs(18,10) :
error CS1061: 'Terraria.Player' does not contain a definition for 'pstone' and
o extension method 'pstone' accepting a first argument of type 'Terraria.Player
 could be found (are you missing a using directive or an assembly reference?)
   at Terraria.ModPackBuilder.compilePerm(String className, String sourceFile,
tring type, Boolean save)
   at Terraria.ModPackBuilder.CompileCSCheck(String className, String codePath,
String type)
Build failed!
Press Enter to continue

Alright, so what does this mean? Well, the bolded and italicized part is telling you the part of your mod that needs fixing, so it's easy to locate what went wrong.

The bold part is giving you the specific error. To find what the error is, look at 'error CS####'. Once you get enough errors you will become more familiar with specific codes. This error is saying that the argument you wrote does not exist, most likely because of a spelling mistake.

player.pstone = true;

This code is incorrect and will cause an error.

player.pStone = true;

That is the correct code, and because it is such a small difference, it could be very easily missed (especially in larger segments of code).

String Passed to the ParseLine Method ErrorEdit

This is the only error that affects an .ini file. (fairly uncommon)

Compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater Armor
\Item\Underwater Chest Piece.cs
String passed to the ParseLine method cannot contain more than one line.
Build failed!

Well, this error is quite odd, and will confuse a lot of people. The bolded and italicized part is telling you the part of your mod that needs fixing, so it's easy to locate what went wrong. Even though the error points to a .cs file, you want to look in your .ini file.

The bold part is giving you the specific error. but for this error, because it doesn't actually affect the .cs file, it cannot point to anything that's wrong. Usually this error will be caused by unknown symbols in the .ini file, or characters that are not allowed.

damage = ÿ„3¢54>ç;

This part of the .ini file will not allow these characters, and will cause the error.

damage = 354;

That is the correct writing. However, it is fairly noticeable, making it one of the most uncommon errors.

Already Defines a Member ErrorEdit

This is a fairly common error.

Compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater Armor
\Item\Underwater Helm.cs
Error compiling C:\Users\Name\Documents\My Games\Terraria\ModPacks\Underwater
 Armor\Item\Underwater Helm.cs
System.Exception: Errors building source code into C:\Users\Name\AppData\Loca
l\Temp\edkv0wth.dll  c:\Users\Name\AppData\Local\Temp\edkv0wth.0.cs(17,20) :
error CS0111: Type 'Terraria.Underwater_Helm_Item' already defines a member call
ed 'Effects' with the same parameter types
   at Terraria.ModPackBuilder.compilePerm(String className, String sourceFile, S
tring type, Boolean save)
   at Terraria.ModPackBuilder.CompileCSCheck(String className, String codePath,
String type)
Build failed!

Alright, so what does this mean? Well, the bolded and italicized part is telling you the part of your mod that needs fixing, so it's easy to locate what went wrong.

The bold part is giving you the specific error. To find what the error is, look at 'error CS####'. Once you get enough errors you will become more familiar with specific codes. This error is saying that the Class you wrote already exists.

public static void Effects(Player player) {
  player.accMerman=true;
  player.statLifeMax=1000;
  player.detectcreature=true;
  player.findTreasure=true;
  player.fireWalk=true;
  player.lavaImmune=true;
  player.nightVision=true;
  player.potionDelay=60;
}
public static void Effects(Player player) {
   int BuffTime = 60; 
   if (BuffTime <= 1) { 
      BuffTime = 60; {
         player.AddBuff(11,(60),false); 
         }
     }
}

This code is declaring Public Static Void Effects twice, Which is causing the error.

public static void Effects(Player player) {
  int BuffTime = 60; 

  player.accMerman=true;
  player.statLifeMax=1000;
  player.detectcreature=true;
  player.findTreasure=true;
  player.fireWalk=true;
  player.lavaImmune=true;
  player.nightVision=true;
  player.potionDelay=60;
   if (BuffTime <= 1) { 
      BuffTime = 60; {
         player.AddBuff(11,(60),false); 
         }
     }
}

This is the correct code.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.