RangeError [EMBED_FIELD_VALUE] MessageEmbed field values must be non-empty strings.

When i try to add more fields I get this error RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
//Original Embed
const EmCarInfo = new MessageEmbed()
.setTitle('title')
.setDescription('Test Test 123')
.addFields(
{ name: 'Field Value', value: `Some values ${test123}` },
)
//Original Embed
const EmCarInfo = new MessageEmbed()
.setTitle('title')
.setDescription('Test Test 123')
.addFields(
{ name: 'Field Value', value: `Some values ${test123}` },
)
when I try to add more fields based on some condition:
if (handling != undefined) {
EmCarInfo.addFields(
{ name: 'test237', value: `Test 123 ${someOtherValue}` }
)
}
if (handling != undefined) {
EmCarInfo.addFields(
{ name: 'test237', value: `Test 123 ${someOtherValue}` }
)
}
I get an error, not sure why is this happening
24 Replies
d.js docs
d.js docs3y 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.
mooz.tsx
mooz.tsx3y ago
Embed field values must be non-empty string
update it to latest v13 at least npm i discord.js@13
Squidward
SquidwardOP3y ago
up to date, audited 35 packages in 1s
mooz.tsx
mooz.tsx3y ago
now check it
Squidward
SquidwardOP3y ago
it works when there is only one addFields option but not together same thing
mooz.tsx
mooz.tsx3y ago
I meant the version
Squidward
SquidwardOP3y ago
yeah nothing changed, same error wdym?
mooz.tsx
mooz.tsx3y ago
yeah error isn't from outdated version but you need to update anyway error doesn't match code send full error
Squidward
SquidwardOP3y ago
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
at Function.verifyString (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\util\Util.js:428:49)
at Function.normalizeField (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:555:19)
at C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:576:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:575:8)
at MessageEmbed.addFields (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:339:42)
at Object.execute (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\commands\vehicle.js:53:5)
at Client.<anonymous> (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\index.js:60:17)
at Client.emit (node:events:402:35)
at InteractionCreateAction.handle (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\client\actions\InteractionCreate.js:83:12) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
at Function.verifyString (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\util\Util.js:428:49)
at Function.normalizeField (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:555:19)
at C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:576:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:575:8)
at MessageEmbed.addFields (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:339:42)
at Object.execute (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\commands\vehicle.js:53:5)
at Client.<anonymous> (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\index.js:60:17)
at Client.emit (node:events:402:35)
at InteractionCreateAction.handle (C:\Users\Test\OneDrive\Desktop\Tree\Other\DiscordBots\GTA_Bot2\node_modules\discord.js\src\client\actions\InteractionCreate.js:83:12) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
mooz.tsx
mooz.tsx3y ago
show vehicle.js line 53
Squidward
SquidwardOP3y ago
it's a bit all over the place
Squidward
SquidwardOP3y ago
mooz.tsx
mooz.tsx3y ago
show it all
d.js docs
d.js docs3y ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
Squidward
SquidwardOP3y ago
Squidward
SquidwardOP3y ago
it might not make any sense
mooz.tsx
mooz.tsx3y ago
isDefined returns an empty string 3rd field value
Squidward
SquidwardOP3y ago
I think the issue is within the third field
Squidward
SquidwardOP3y ago
mooz.tsx
mooz.tsx3y ago
vehicle properties that your put are undefined
Squidward
SquidwardOP3y ago
nvm i figured it out i was actually returning an empty string
mooz.tsx
mooz.tsx3y ago
yeah bc value is always undefined
Squidward
SquidwardOP3y ago
thank you for your help anyway
Want results from more Discord servers?
Add your server