Troubleshooting
Common issues and how to fix them.
Bot Issues
Bot doesn't respond to commands
Possible causes:
- Message Content Intent not enabled
- Bot lacks permissions
- Wrong command prefix
- Bot not in the correct channel
Solutions:
- Enable Message Content Intent in Discord Developer Portal
- Check bot has "Read Messages" and "Send Messages" permissions
- Verify your bot prefix matches what you're typing
- Ensure bot is in the channel you're testing in
Bot shows "undefined" instead of username
Cause: Discord.js v14 uses user.username not user.name
Solution: Newt automatically handles this, but if you see this issue, ensure you're using the latest version:
bash
npm update -g @newt-dev/cliBot crashes on startup
Check:
- DISCORD_TOKEN environment variable is set
- Token is valid (not expired or revoked)
- Node.js version is 20 or higher
Debug:
bash
DISCORD_TOKEN="your-token" npm startBuild Issues
"Cannot find module @newt-dev/compiler"
Cause: Compiler package not installed
Solution:
bash
npm install -g @newt-dev/cli"Syntax error" in .newt file
Common issues:
- Inconsistent indentation (mix 2 and 4 spaces)
- Missing colons after event handlers
- Unclosed quotes in strings
Check with:
bash
newt check my-bot.newt"Token not found" error
Cause: Token not set as environment variable
Solution:
bash
# Windows PowerShell
$env:DISCORD_TOKEN="your-token"
# Linux/Mac
export DISCORD_TOKEN="your-token"Installation Issues
"Permission denied" on global install
Linux/Mac:
bash
sudo npm install -g @newt-dev/cliWindows:
- Run terminal as Administrator
- Or use a user-local install:
bash
npm install @newt-dev/cli
npx newt check my-bot.newt"Command not found" after install
Check npm global bin location:
bash
npm config get prefixAdd that path to your system PATH, or use npx:
bash
npx newt check my-bot.newtRuntime Issues
Database errors (points-bot)
Cause: SQLite database file permissions
Solution:
- Ensure bot has write permissions in its directory
- Delete
newt-store.sqliteand let it recreate - Check disk space
Rate limiting errors
Cause: Sending messages too quickly
Solution:
- Add
waitstatements between messages - Use
for eachwith delays - Implement rate limiting in your bot logic
Role management errors
Cause: Bot lacks "Manage Roles" permission
Solution:
- Go to Discord Developer Portal
- Enable "Manage Roles" in bot permissions
- Re-invite bot to server with new permissions
- Ensure bot's role is higher than roles it's trying to assign
Development Issues
VS Code extension not working
Solutions:
- Reload VS Code window
- Check extension is installed
- Ensure file has
.newtextension - Check VS Code version (1.80+ required)
Hot reload not working
Cause: Need to rebuild after code changes
Solution:
bash
newt build my-bot.newt --out my-bot
cd my-bot
npm startGetting Help
If you're still stuck:
- Check the Quickstart Guide
- Review Language Reference
- Look at Examples
- Search existing issues on GitHub
Reporting Bugs
When reporting bugs, include:
- Newt version (
newt --version) - Node.js version (
node --version) - Operating system
- Your
.newtfile (remove sensitive data) - Error messages or stack traces
- Steps to reproduce