I get this type error from my code (the code with the error is above the error):
Info: Using the environment variable: NIMBLE_DIR='/home/runner/libmtg/nimble-env'
Hint: used config file '/home/runner/.choosenim/toolchains/nim-2.0.4/config/nim.cfg' [Conf]
Hint: used config file '/home/runner/.choosenim/toolchains/nim-2.0.4/config/config.nims' [Conf]
Hint: used config file '/home/runner/libmtg/tests/config.nims' [Conf]
Hint: used config file 'tests/cardbank.nims' [Conf]
..........................................................................................................................................................
/home/runner/libmtg/src/libmtg/cards.nim(60, 22) Warning: imported and not used: 'dynlib' [UnusedImport]
......
proc islandHandle_553648131() {.cdecl, exportc, dynlib.} =
  echo "Event"
const
  islandHandle = "islandHandle_553648131"
const
  cards`gensym3: array[0 .. 2, CardObject] = [(card "Island" do:
    cost = []
    typeline = [Basic, Land, {Island}]
    text = "({T}: Add {U}.)"
    imageUrl = "https://cards.scryfall.io/normal/front/a/c/acd6be3f-745c-41ad-95c9-1db66ba56be2.jpg?1712356421"
    expansion = "Outlaws of Thunder Junction"
    rarity = "common"
    collectorNumber = 279
    eventHandle = islandHandle)[], (scryfallCard "Forest",
      "baf8a774-65f3-431e-b084-328ff1000895" do:(discard ))[], (scryfallCard
      "Aegis Turtle", "7003ebae-5d82-4360-ae63-0e51c37977ed" do:(discard ))[]] # Error line
proc load(): Table[string, CardObject] {.exportc, cdecl, dynlib.} =
  for c`gensym3 in cards`gensym3:
    result[c`gensym3.name] = c`gensym3
Card(name: "Island", cost: @[], typeline: newTypeLine({SuperType.Basic},
    {MainType.Land}, {SubType.Island}), text: "({T}: Add {U}.)", imageUrl: "https://cards.scryfall.io/normal/front/a/c/acd6be3f-745c-41ad-95c9-1db66ba56be2.jpg?1712356421",
     expansion: "Outlaws of Thunder Junction", rarity: "common",
     collectorNumber: 279, eventHandle: islandHandle)
Card(name: "Forest", imageUrl: "https://cards.scryfall.io/normal/front/b/a/baf8a774-65f3-431e-b084-328ff1000895.jpg?1712356407",
     text: "({T}: Add {G}.)", expansion: "Outlaws of Thunder Junction",
     collectorNumber: 276, rarity: "common", cost: @[], typeline: newTypeLine(
    {SuperType.Basic}, {MainType.Land}, {SubType.Forest}), power: -1,
     toughness: -1)
Card(name: "Aegis Turtle", imageUrl: "https://cards.scryfall.io/normal/front/7/0/7003ebae-5d82-4360-ae63-0e51c37977ed.jpg?1600697500",
     text: "", expansion: "Jumpstart", collectorNumber: 138, rarity: "common",
     cost: @[ManaCostType.Blue], typeline: newTypeLine(
    {SuperType.SuperTypeNone}, {MainType.Creature}, {SubType.Turtle}), power: 0,
     toughness: 5)
/home/runner/libmtg/tests/cardbank.nim(8, 1) template/generic instantiation of `cardSet` from here
/home/runner/libmtg/src/libmtg/cardgen.nim(22, 11) Error: invalid type: 'CardSet' in this context: 'array[0..2, CardObject]' for const
stack trace: (most recent call last)
/tmp/nimblecache-946033505/nimscriptapi_2207287390.nim(222, 29)
/home/runner/libmtg/libmtg.nimble(18, 3) testBefore
/home/runner/.choosenim/toolchains/nim-2.0.4/lib/system/nimscript.nim(265, 7) exec
[1m/home/runner/.choosenim/toolchains/nim-2.0.4/lib/system/nimscript.nim(265, 7) [0m[31mError: [0munhandled exception: FAILED: nim c tests/cardbank [OSError][36m[0m[0m
       Tip: 2 messages have been suppressed, use --verbose to show them.
nimscriptwrapper.nim(160) execScript
    
    Error:  Exception raised during nimble script execution
 The error is Error: invalid type: 'CardSet' in this context: 'array[0..2, CardObject]' for const stack trace: (most recent call last). I already checked and nim gives a different error if the type of the objects being passed to the array is wrong, and that they were all CardObjects. All other errors I could fine relating to Invalid type in context were all generic errors, which none of my types have. Why is this error popping up, and how do I fix it?
Keep in mind this section was working before, but I added the card set type to a file that this section imports, and then this error appeared.
CardSet* = ref object
    cards*: Table[string, Card]
    # legalityBinding: set[]
    sourcePath: string # Local source path
    
    # Meta (optional)
    webSource: string # Web download url
    name: string # Can be ""
 ^^^ Is the definition.And the card types:
CardObject* = object
    source: Cardset
    
    name*: string
    text*: string
    imageUrl*: string
    expansion*: string
    rarity*: string
    collectorNumber*: int
    cost*: seq[ManaCostType] # empty is land
    typeLine*: TypeLine
    
    power*: int = -1 # -1: None -2: *
    toughness*: int = -1 # -1: None -2: *
    
    eventHandle*: string
    eventHandleProc: proc ()
    statelessEventHandle*: string
    statelessEventHandleProc*: proc ()
    # triggers*: set[uint8] # What events to pass
  
  Card* = ref CardObject