CombinedError upon embed creation

Error:
CombinedError (3)
Received one or more errors

1 ExpectedValidationError > s.literal(V)
| Expected values to be equals
|
| Expected:
| | null
|
| Received:
| | undefined

2 ValidationError > s.number
| Expected a number primitive
|
| Received:
| | undefined

3 ValidationError > s.tuple(T)
| Expected an array
|
| Received:
| | undefined

at UnionValidator.handle (/Users/pc/bot/node_modules/@sapphire/shapeshift/dist/index.js:1104:23)
at UnionValidator.parse (/Users/pc/bot/node_modules/@sapphire/shapeshift/dist/index.js:212:88)
at EmbedBuilder.setColor (/Users/pc/bot/node_modules/@discordjs/builders/dist/index.js:301:20)
at EmbedBuilder.setColor (/Users/pc/bot/node_modules/discord.js/src/structures/EmbedBuilder.js:23:18)
at Object.module.exports.run (/Users/pc/bot/commands/admin/bulkadd.js:9:4)
at module.exports (/Users/pc/bot/util/events/events/messageCreate.js:18:17)
at Client.<anonymous> (/Users/pc/bot/util/events/index.js:7:69)
at Client.emit (node:events:513:28)
at MessageCreateAction.handle (/Users/pc/bot/node_modules/discord.js/src/client/actions/MessageCreate.js:28:14)
at Object.module.exports [as MESSAGE_CREATE] (/Users/pc/bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
CombinedError (3)
Received one or more errors

1 ExpectedValidationError > s.literal(V)
| Expected values to be equals
|
| Expected:
| | null
|
| Received:
| | undefined

2 ValidationError > s.number
| Expected a number primitive
|
| Received:
| | undefined

3 ValidationError > s.tuple(T)
| Expected an array
|
| Received:
| | undefined

at UnionValidator.handle (/Users/pc/bot/node_modules/@sapphire/shapeshift/dist/index.js:1104:23)
at UnionValidator.parse (/Users/pc/bot/node_modules/@sapphire/shapeshift/dist/index.js:212:88)
at EmbedBuilder.setColor (/Users/pc/bot/node_modules/@discordjs/builders/dist/index.js:301:20)
at EmbedBuilder.setColor (/Users/pc/bot/node_modules/discord.js/src/structures/EmbedBuilder.js:23:18)
at Object.module.exports.run (/Users/pc/bot/commands/admin/bulkadd.js:9:4)
at module.exports (/Users/pc/bot/util/events/events/messageCreate.js:18:17)
at Client.<anonymous> (/Users/pc/bot/util/events/index.js:7:69)
at Client.emit (node:events:513:28)
at MessageCreateAction.handle (/Users/pc/bot/node_modules/discord.js/src/client/actions/MessageCreate.js:28:14)
at Object.module.exports [as MESSAGE_CREATE] (/Users/pc/bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
Code:
const Discord = require("discord.js");

module.exports.run = async (bot, message, args, db, prefix, functions, config, color) => {
if(!bot.config.users.admins.includes(message.author.id)) return bot.functions.txt.deny(message);
const attachments = message.attachments;

var embed = new Discord.EmbedBuilder()
.setDescription('error')
.setColor(color);
if(!attachments.size) return message.channel.send({ embeds: [ embed ] });
console.log(attachments);
};
const Discord = require("discord.js");

module.exports.run = async (bot, message, args, db, prefix, functions, config, color) => {
if(!bot.config.users.admins.includes(message.author.id)) return bot.functions.txt.deny(message);
const attachments = message.attachments;

var embed = new Discord.EmbedBuilder()
.setDescription('error')
.setColor(color);
if(!attachments.size) return message.channel.send({ embeds: [ embed ] });
console.log(attachments);
};
Unsure as to what caused this, have tried recoding the embed part several times but it just doesn't seem to work. If any other part of the code is required, please let me know. Discord.js v14.11.0
8 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Syjalo
Syjalo12mo ago
Your color is undefined
jeffthedev
jeffthedev12mo ago
ah oops thank you just a side queston, is there any easier way to read the errors?
Syjalo
Syjalo12mo ago
Syjalo
Syjalo12mo ago
It's as simple as possible
treble/luna
treble/luna12mo ago
and using a linter also prevents you from adding undefined variables iirc
I_exist_now?
I_exist_now?12mo ago
Every error message in JS should show the file, line, and column that it occurs at.
jeffthedev
jeffthedev12mo ago
ty sure, will look into that