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 docs2y 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.
Squidward
Squidward2y ago
discord.js@13.8.1
mooz.tsx
mooz.tsx2y ago
Embed field values must be non-empty string
update it to latest v13 at least npm i discord.js@13
Squidward
Squidward2y ago
up to date, audited 35 packages in 1s
mooz.tsx
mooz.tsx2y ago
now check it
Squidward
Squidward2y ago
it works when there is only one addFields option but not together same thing
mooz.tsx
mooz.tsx2y ago
I meant the version
Squidward
Squidward2y ago
yeah nothing changed, same error wdym?
mooz.tsx
mooz.tsx2y ago
yeah error isn't from outdated version but you need to update anyway error doesn't match code send full error
Squidward
Squidward2y 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.tsx2y ago
show vehicle.js line 53
Squidward
Squidward2y ago
it's a bit all over the place
Squidward
Squidward2y ago
mooz.tsx
mooz.tsx2y ago
show it all
d.js docs
d.js docs2y ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
Squidward
Squidward2y ago
Squidward
Squidward2y ago
it might not make any sense
mooz.tsx
mooz.tsx2y ago
isDefined returns an empty string 3rd field value
Squidward
Squidward2y ago
I think the issue is within the third field
Squidward
Squidward2y ago
mooz.tsx
mooz.tsx2y ago
vehicle properties that your put are undefined
Squidward
Squidward2y ago
nvm i figured it out i was actually returning an empty string
mooz.tsx
mooz.tsx2y ago
yeah bc value is always undefined
Squidward
Squidward2y ago
thank you for your help anyway