Discord.js “ValidationError: Expected a string primitive” when loading commands

I created another command like usual, but it shows the “ValidationError: Expected a string primitive” error and I’m not sure why.
This is the at file:///home/egganto/Documents/Athena/src/commands/perimeter.js:157:33 it’s referring to:

import { SlashCommandBuilder } from "discord.js";

const perimeterCommand = new SlashCommandBuilder()
  .setName("perimeter")
  .setDescription("Solves for the perimeter")
  // subcommand for parallelogram
  .addSubcommand((subcommand) =>
    subcommand
    .setName("parallelogram")
    .setDescription("Solves for the perimeter of the parallelogram")
    .addNumberOption((option) =>
      option
      .setName("base")
      .setDescription("The value of the base of the parallelogram")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
        .setName("height")
        .setDescription("The value of height of the parallelogram")
        .setRequired(true)
      )
    )

  // subcommand for triangle
  .addSubcommand((subcommand) =>
    subcommand)
    .setName("triangle")
    .setDescription("Finds the perimeter of a triangle")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("value of side a of the triangle")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("b")
      .setDescription("value of side b of the triangle")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("c")
      .setDescription("value of side c of the triangle")
      .setRequired(true)
    )

  // subcommand for rectangle
  .addSubcommand((subcommand) =>
    subcommand
    .setName("rectangle")
    .setDescription("finds the perimeter of a rectangle")
    .addNumberOption((option) =>
      option
      .setName("length")
      .setDescription("value of length of rectangle")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("width")
      .setDescription("value of length of rectangle")
      .setRequired(true)
    )
  )

  // subcommand for square
  .addSubcommand((subcommand) =>
    subcommand
    .setName("square")
    .setDescription("fnds perimeter of a square")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("value of a side of a square")
      .setRequired(true)
    )
  )

  // subcommand for trapezoid
  .addSubcommand((subcommand) =>
    subcommand
    .setName("trapezoid")
    .setDescription("finds perimeter of trapezoid")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("value of side a of trapezoid")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("b")
      .setDescription("value of side b of trapezoid")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("c")
      .setDescription("value of side c of trapezoid")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("d")
      .setDescription("value of side d of trapezoid")
      .setRequired(true)
    )
  )

  // subcommand for kite
  .addSubcommand((subcommand) =>
    subcommand
    .setName("kite")
    .setDescription("finds perimeter of kite")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("length of first pair of equal sides")
      .setRequired(true)
    )
    .addNumberOption((option) =>
      option
      .setName("b")
      .setDescription("length of second pair of equal sides")
      .setRequired(true)
    )
  )

  // subcommand for rhombus
  .addSubcommand((subcommand) =>
    subcommand
    .setName("rhombus")
    .setDescription("finds perimeter of rhombus")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("length of a side")
      .setRequired(true)
    )
  )

  // subcommand for hexagon
  .addSubcommand((subcommand) =>
    subcommand
    .setName("hexagon")
    .setDescription("finds perimeter of hexagon")
    .addNumberOption((option) =>
      option
      .setName("a")
      .setDescription("length of a side")
      .setRequired(true)
    )
  );

export default perimeterCommand.toJSON();

line 157:33 being export default perimeterCommand.toJSON();

This is the full error:

[nodemon] starting `node ./src/index.js run`
/home/egganto/Documents/Athena/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2473
    return typeof value === "string" ? Result.ok(value) : Result.err(new ValidationError("s.string", "Expected a string primitive", value));
                                                                     ^

ValidationError: Expected a string primitive
    at _StringValidator.handle (/home/egganto/Documents/Athena/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2473:70)
    at _StringValidator.parse (/home/egganto/Documents/Athena/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:939:90)
    at validateName (/home/egganto/Documents/Athena/node_modules/@discordjs/builders/dist/index.js:1578:17)
    at validateRequiredParameters (/home/egganto/Documents/Athena/node_modules/@discordjs/builders/dist/index.js:1597:3)
    at MixedClass.toJSON (/home/egganto/Documents/Athena/node_modules/@discordjs/builders/dist/index.js:2358:5)
    at /home/egganto/Documents/Athena/node_modules/@discordjs/builders/dist/index.js:2506:52
    at Array.map (<anonymous>)
    at MixedClass.toJSON (/home/egganto/Documents/Athena/node_modules/@discordjs/builders/dist/index.js:2506:29)
    at file:///home/egganto/Documents/Athena/src/commands/perimeter.js:157:33
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25) {
  validator: 's.string',
  given: undefined
}

Node.js v20.12.2

I tried checking if I missed any description/require attributes, and if I haven’t missed anything, I think it might not be missing something

New contributor

egganto is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật