[solved] "sudo nixos-rebuild switch" results in "failed to canonicalize /nix/store/***/kernel-modules/bzImage: No such file or directory"

Hi im having an issue where trying to run sudo nixos-rebuild switch results in “failed to canonicalize /nix/store/***/kernel-modules/bzImage: No such file or directory” error.

I was trying to use flakes, and that’s around when this issue started, but even after switching back to previous setups without flakes, this problem persists. What can I do to fix this?

configuration.nix: Mozilla Community Pastebin/3kk8JHkF (JavaScript)
hardware-configuration: Mozilla Community Pastebin/vdWH3NOw (JavaScript)

full error: Mozilla Community Pastebin/z991RSzG (JavaScript)

solved by running sudo nix-collect-garbage -d