Error: IOError: symlink: operation not permitted (EPERM)

Hello,
Pretty new to julia, have used it ever so often for school work the last few years, but not very familiar at all. When running the code below I get the error posted below. It is mainly the error stated in the title that I need help with, as I think the first error has to do with my code, but feel free to correct that as well.

Not very familiar with stacktraces and dictionaries, so explain as if I was a 5 year old. Thank you:)

The main file:

using JuMP
import Ipopt

include("data.jl")

model = Model(Ipopt.Optimizer)

# Voltage amplitude at each node
@variable(model, 0.98 <= v[n in nodes] <= 1.02)

# Voltage phase angle at each node
@variable(model, -pi <= θ[n in nodes] <= pi)

# Active power generation
@variable(model, 0 <= P_G[i in generators] <= P_G_max[i])

# Reactive power generation (limited to ±3% of max capacity)
@variable(model, Q_G[i in generators],
    lower_bound = -0.03 * P_G_max[i],
    upper_bound = 0.03 * P_G_max[i]
)

# Active power flow from node k to l
@variable(model, p[(k, l) in edges])

# Reactive power flow from node k to l
@variable(model, q[(k, l) in edges])

@objective(model, Min, sum(costs[i] * P_G[i] for i in generators))

# Active power flow equations
for (k, l) in edges
    g = gkl[(k, l)]
    b = bkl[(k, l)]
    @NLconstraint(model,
        p[(k, l)] == v[k]^2 * g -
                     v[k] * v[l] * (g * cos(θ[k] - θ[l]) + b * sin(θ[k] - θ[l]))
    )
end

# Reactive power flow equations
for (k, l) in edges
    g = gkl[(k, l)]
    b = bkl[(k, l)]
    @NLconstraint(model,
        q[(k, l)] == -v[k]^2 * b -
                      v[k] * v[l] * (g * sin(θ[k] - θ[l]) - b * cos(θ[k] - θ[l]))
    )
end

for n in nodes
    # Total active power generated at node n
    P_G_node = sum(P_G[i] for i in keys(generators) if generators[i] == n)
    
    # Active power demand at node n
    D_n = demand_at_node[n]
    
    # Net active power flow (incoming - outgoing)
    incoming_p = sum(p[(k, n)] for k in neighbors[n] if (k, n) in edges)
    outgoing_p = sum(p[(n, k)] for k in neighbors[n] if (n, k) in edges)
    
    @constraint(model, P_G_node - D_n + incoming_p - outgoing_p == 0)
end

for n in nodes
    # Total reactive power generated at node n
    Q_G_node = sum(Q_G[i] for i in keys(generators) if generators[i] == n)
    
    # Net reactive power flow (incoming - outgoing)
    incoming_q = sum(q[(k, n)] for k in neighbors[n] if (k, n) in edges)
    outgoing_q = sum(q[(n, k)] for k in neighbors[n] if (n, k) in edges)
    
    @constraint(model, Q_G_node + incoming_q - outgoing_q == 0)
end

optimize!(model)

using tha data in the file below.

nodes = 1:11

# Edges between nodes
edges = [
    (1, 2),
    (1, 11),
    (2, 3),
    (2, 11),
    (3, 4),
    (3, 9),
    (4, 5),
    (5, 6),
    (5, 8),
    (6, 7),
    (7, 8),
    (7, 9),
    (8, 9),
    (9, 10),
    (10, 11)
]

# Parameters for each edge 
bkl_values = [-20.1, -22.3, -16.8, -17.2, -11.7, -19.4, -10.8, -12.3, -9.2, -13.9, -8.7, -11.3, -7.7, -13.5, -26.7]
gkl_values = [4.12, 5.67, 2.41, 2.78, 1.98, 3.23, 1.59, 1.71, 1.26, 1.11, 1.32, 2.01, 4.41, 2.14, 5.06]

# Create dictionaries mapping edges to their parameters
bkl = Dict(edges[i] => bkl_values[i] for i in 1:length(edges))
gkl = Dict(edges[i] => gkl_values[i] for i in 1:length(edges))

# Generators and their nodes
generators = Dict(
    1 => 2,
    2 => 2,
    3 => 2,
    4 => 3,
    5 => 4,
    6 => 5,
    7 => 7,
    8 => 9,
    9 => 9
)

# Maximum capacities 
P_G_max = Dict(
    1 => 0.02,
    2 => 0.15,
    3 => 0.08,
    4 => 0.07,
    5 => 0.04,
    6 => 0.17,
    7 => 0.17,
    8 => 0.26,
    9 => 0.05
)

# Production costs 
costs = Dict(
    1 => 175,
    2 => 100,
    3 => 150,
    4 => 150,
    5 => 300,
    6 => 350,
    7 => 400,
    8 => 300,
    9 => 200
)

# Consumers and their nodes
consumers = Dict(
    1 => 1,
    2 => 4,
    3 => 6,
    4 => 8,
    5 => 9,
    6 => 10,
    7 => 11
)

# Demands 
D_k = Dict(
    1 => 0.10,
    2 => 0.19,
    3 => 0.11,
    4 => 0.09,
    5 => 0.21,
    6 => 0.05,
    7 => 0.04
)

# Map demands to nodes
demand_at_node = Dict(n => 0.0 for n in nodes)
for (c, n) in consumers
    demand_at_node[n] += D_k[c]
end

# Initialize neighbor dictionary
neighbors = Dict(n => Int[] for n in nodes)

# Populate neighbors for undirected edges
for (k, l) in edges
    push!(neighbors[k], l)
    push!(neighbors[l], k)
end

produces the following stacktrace:

ERROR: KeyError: key 7 => 7 not found
Stacktrace:
 [1] getindex(::Dict{Int64,Float64}, ::Pair{Int64,Int64}) at .\dict.jl:477
 [2] (::var"#97#98")(::Pair{Int64,Int64}) at C:\Users\keijs\.julia\packages\JuMP\MnJQc\src\Containers\macro.jl:183
 [3] #28 at C:\Users\keijs\.julia\packages\JuMP\MnJQc\src\Containers\container.jl:85 [inlined]
 [4] iterate at .\generator.jl:47 [inlined]
 [5] collect(::Base.Generator{JuMP.Containers.VectorizedProductIterator{Tuple{Dict{Int64,Int64}}},JuMP.Containers.var"#28#29"{var"#97#98"}}) at .\array.jl:665
 [6] map(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Dict{Int64,Int64}}}) at .\abstractarray.jl:2098
 [7] container(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Dict{Int64,Int64}}}, ::Type{JuMP.Containers.DenseAxisArray}) at C:\Users\keijs\.julia\packages\JuMP\MnJQc\src\Containers\container.jl:85
 [8] container(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Dict{Int64,Int64}}}) at C:\Users\keijs\.julia\packages\JuMP\MnJQc\src\Containers\container.jl:65
 [9] top-level scope at C:\Users\keijs\.julia\packages\JuMP\MnJQc\src\macros.jl:79

caused by: IOError: symlink: operation not permitted (EPERM)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] symlink(::String, ::String) at .\file.jl:958
 [3] probe_symlink_creation(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:132
 [4] unpack(::String, ::String; verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:994
 [5] download_verify_unpack(::String, ::String, ::String; tarball_path::Nothing, ignore_existence::Bool, force::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:1170
 [6] download_artifact(::Base.SHA1, ::String, ::String; verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:750
 [7] (::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String})() at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:890
 [8] with_show_download_info(::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String}, ::String, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:907
 [9] ensure_artifact_installed(::String, ::Dict{String,Any}, ::String; platform::Pkg.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:889
 [10] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:958
 [11] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:609
 [12] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:588
 [13] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1084
 [14] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:159
 [15] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:112
 [16] #add#27 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [17] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [18] #add#24 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [19] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [20] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [21] add(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [22] top-level scope at REPL[1]:1

caused by: IOError: symlink: operation not permitted (EPERM)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] symlink(::String, ::String) at .\file.jl:958
 [3] probe_symlink_creation(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:132
 [4] unpack(::String, ::String; verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:994
 [5] download_verify_unpack(::String, ::String, ::String; tarball_path::Nothing, ignore_existence::Bool, force::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:1170
 [6] download_artifact(::Base.SHA1, ::String, ::String; verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:750
 [7] (::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String})() at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:890
 [8] with_show_download_info(::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String}, ::String, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:907
 [9] ensure_artifact_installed(::String, ::Dict{String,Any}, ::String; platform::Pkg.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:889
 [10] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:958
 [11] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:609
 [12] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:588
 [13] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1084
 [14] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:159
 [15] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:112
 [16] #add#27 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [17] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [18] #add#24 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [19] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [20] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [21] add(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [22] top-level scope at REPL[1]:1

caused by: IOError: symlink: operation not permitted (EPERM)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] symlink(::String, ::String) at .\file.jl:958
 [3] probe_symlink_creation(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:132
 [4] unpack(::String, ::String; verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:994
 [5] download_verify_unpack(::String, ::String, ::String; tarball_path::Nothing, ignore_existence::Bool, force::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:1170
 [6] download_artifact(::Base.SHA1, ::String, ::String; verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:750
 [7] (::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String})() at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:890
 [8] with_show_download_info(::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String}, ::String, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:907
 [9] ensure_artifact_installed(::String, ::Dict{String,Any}, ::String; platform::Pkg.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:889
 [10] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:958
 [11] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:609
 [12] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:588
 [13] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1084
 [14] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:159
 [15] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:112
 [16] #add#27 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [17] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [18] #add#24 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [19] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [20] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [21] add(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [22] top-level scope at REPL[1]:1

caused by: IOError: symlink: operation not permitted (EPERM)
Stacktrace:
 [1] uv_error at .\libuv.jl:97 [inlined]
 [2] symlink(::String, ::String) at .\file.jl:958
 [3] probe_symlink_creation(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:132
 [4] unpack(::String, ::String; verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:994
 [5] download_verify_unpack(::String, ::String, ::String; tarball_path::Nothing, ignore_existence::Bool, force::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\PlatformEngines.jl:1170
 [6] download_artifact(::Base.SHA1, ::String, ::String; verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:750
 [7] (::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String})() at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:890
 [8] with_show_download_info(::Pkg.Artifacts.var"#44#46"{Bool,Bool,Base.SHA1,String}, ::String, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:907
 [9] ensure_artifact_installed(::String, ::Dict{String,Any}, ::String; platform::Pkg.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:889
 [10] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Artifacts.jl:958
 [11] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:609
 [12] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:588
 [13] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1084
 [14] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:159
 [15] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:112
 [16] #add#27 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [17] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
 [18] #add#24 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [19] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
 [20] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [21] add(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
 [22] top-level scope at REPL[1]:1

Grateful for any help!

Hello and welcome to the Julia discourse.

I think the issue is that you are running Julia 1.4. Updating to Julia 1.10.5 Download Julia should fix the symlink error.

It solved the symblink problem. The keyError remains though.

ERROR: KeyError: key 5 => 4 not found
Stacktrace:
  [1] getindex(h::Dict{Int64, Float64}, key::Pair{Int64, Int64})
    @ Base .\dict.jl:498
  [2] macro expansion
    @ C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\macros\@variable.jl:277 [inlined]
  [3] (::var"#37#38"{Model})(i::Pair{Int64, Int64})
    @ Main C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\Containers\macro.jl:545
  [4] #87
    @ C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\Containers\container.jl:124 [inlined]
  [5] iterate
    @ .\generator.jl:47 [inlined]
  [6] collect(itr::Base.Generator{JuMP.Containers.VectorizedProductIterator{…}, JuMP.Containers.var"#87#89"{…}})
    @ Base .\array.jl:834
  [7] map(f::Function, A::JuMP.Containers.VectorizedProductIterator{Tuple{Dict{Int64, Int64}}})
    @ Base .\abstractarray.jl:3313
  [8] container(f::Function, indices::JuMP.Containers.VectorizedProductIterator{…}, ::Type{…}, names::Vector{…})
    @ JuMP.Containers C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\Containers\container.jl:123
  [9] container(f::Function, indices::JuMP.Containers.VectorizedProductIterator{…}, ::Type{…}, names::Vector{…})
    @ JuMP.Containers C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\Containers\container.jl:75
 [10] macro expansion
    @ C:\Users\keijs\.julia\packages\JuMP\6RAQ9\src\macros.jl:393 [inlined]
 [11] top-level scope
    @ c:\Users\keijs\Chalmers\Olinjär optimering\Project\model.jl:15
Some type information was truncated. Use `show(err)` to see complete types.

But should probably mark this as resolved as that was the main problem I was asking about, right?

You probably want to iterate over either the keys or values of generators, not the pairs. You don’t have pairs as keys in P_G.

yes, this did resolve it. I iterated over keys(generators) instead. Thank you!