When you’re building custom mods or tweaking mechanics in Minecraft using KubeJS, you might frequently encounter errors flagged simply as “Errors Found”. These messages show up during world loading or when refreshing scripts, sometimes stopping your entire modpack from running properly. Though this can be frustrating, these errors are there to guide you toward fixing issues in your scripts. In this guide, we’ll walk you through the various causes of “Errors Found” messages in KubeJS, explain how to fix them, and offer best practices for future-proof scripting.
TL;DR
If you’re seeing “Errors Found” in your KubeJS environment, it’s likely due to a syntax error, invalid item or recipe references, or scripts that reference mods not loaded. Start by checking your server or client log files for detailed error descriptions. Most issues can be resolved by correcting typos, verifying mod dependencies, and ensuring correct file structure. Always test changes incrementally and back up before editing scripts.
Understanding KubeJS and Its Error System
KubeJS is a powerful scripting mod for Minecraft that lets you customize gameplay using JavaScript. Whether you’re adding custom recipes, events, or item behaviors, any mistake in your code or file setup triggers KubeJS to report “Errors Found”, typically during startup.
These errors won’t always tell you exactly what’s wrong in the game UI, which is why checking your logs is crucial. Errors can arise from:
- Syntax issues in JavaScript code
- Incorrect object or method names
- Referencing non-existent items or mods
- Missing semicolons or brackets
- Scripts loading in the wrong stage (server vs client)
Step 1: Check the Startup Logs
The most reliable place to start fixing KubeJS errors is the log file. Here’s how to locate it:
- If you’re using a client, go to .minecraft/logs/kubejs.log
- If you’re on a server, check logs/kubejs/server_scripts.log
Open the log file in a text editor and look for lines marked with [ERROR] or [Script]. These entries typically include:
- The line number of the script where the error occurred
- The nature of the error (e.g., “undefined is not a function”)
- The name of the script file with issues
Copy and paste the log entry into a JavaScript syntax validator or search online for clues on what the error might indicate.
Step 2: Fixing Common Script Errors
Here are the most frequent script errors newbies and experienced modders run into, and how to resolve them:
1. Typo or Syntax Error
Maybe you wrote:
event.recipes.minecraft.crafting_shaped('minecraft:stick', [[ 'planks' ]])
But missed a proper definition of the pattern. The correct version would be:
event.recipes.minecraft.crafting_shaped('minecraft:stick', [ ['planks'], ['planks'] ])
2. Invalid Item or Tag
If you’re referencing an item or tag that doesn’t exist, you’ll get an error. For example:
item.of('notamod:ghost_item')
notamod:ghost_item doesn’t exist, which breaks the script. Double-check item IDs using tools like JEI or KubeJS dev tools.
3. Script Type Misuse
Scripts in KubeJS are split into different folders depending on their role:
server_scripts– For recipe and world changesclient_scripts– For UI and visual tweaksstartup_scripts– Runs once during game loading
If you try to use client-only functions (like tooltips or item colors) inside server scripts, you’ll get script errors. Be mindful where you place each file.
Step 3: Use try/catch for Testing
When developing, you can wrap parts of your code in a try { ... } catch(e) { console.log(e) } block. This prevents a failed line from crashing the entire script.
try {
event.recipes.minecraft.crafting_shaped('minecraft:diamond', [
['minecraft:dirt', 'minecraft:dirt', 'minecraft:dirt'],
['minecraft:dirt', 'minecraft:stick', 'minecraft:dirt'],
['minecraft:dirt', 'minecraft:dirt', 'minecraft:dirt']
])
} catch(e) {
console.log("Recipe failed to load: " + e)
}
This method is great during experimentation, but don’t forget to clean up once your scripts are stable.
Step 4: Validate Your Script File Structure
As of KubeJS for newer Minecraft versions (1.18+), scripts must follow a structured loading mechanism. Make sure you’re not dropping files directly into the kubejs folder. The typical structure is:
kubejs/ ├── config/ ├── client_scripts/ ├── server_scripts/ ├── startup_scripts/ └── assets/
This ensures each script loads in the intended stage of the game. Incorrect placement results in scripts not being processed at all or causing an error message.
Step 5: Ensure Mod Compatibility
Another major cause of “Errors Found” is when you reference another mod’s content, like an item or block, but that mod is missing or not loaded properly. For example:
event.recipes.create.mixing('minecraft:diamond', [ '#forge:ingots/iron', '#forge:dusts/redstone' ])
If Create isn’t installed or has an incompatible version, this line will crash. Always make sure:
- Dependent mods are installed and enabled
- You’re referencing mod elements based on their correct IDs
- You use
Platform.mods.kubejsto check for mod presence
Example of safe referencing:
if (Platform.mods.create) {
event.recipes.create.mixing('minecraft:diamond', [ '#forge:ingots/iron', '#forge:dusts/redstone' ])
}
Tools and Utilities to Help You Debug
If you’re dealing with complex scripts, these tools can help identify and patch errors:
- Visual Studio Code: Offers syntax highlighting and JS linting
- KubeJS REPL (in-game command): Lets you test JS code without restarting
- Script Validator Mods: Some packs offer GUI tools to auto-highlight broken scripts
- Online JS linters: Run scripts through tools like JSHint or ESLint
Best Practices to Prevent Future Errors
A few proactive habits go a long way in keeping your KubeJS scripting environment smooth:
- Comment complex code: Leave notes for yourself or other modders
- Version your scripts: Create backups before major edits
- Validate with JEI/mod tools: Ensure referenced item IDs and tags exist
- Mod presence checks: Always check if a mod is present before referencing it
- Divide scripts logically: One script per major system or mod
Conclusion
While the “Errors Found” message in KubeJS can be intimidating, it’s essentially your editor reminding you something’s off. By using logs, understanding common error types, and following scripting best practices, you can resolve most issues swiftly. The key lies in learning from errors and iterating your scripts over time. With a bit of patience and attention to detail, your custom Minecraft experience will run smoother and more impressively than ever.
Happy modding!