Dynamic Supervisor wont start a child

Hey there!

Im trying to start a child on my dynamic supervisor , but i always get this error:

    {Logic.Container.Fetcher, :start_link,
     [clearance_id: "clearance_id", status: "status"], []},
    {DynamicSupervisor, :start_child, 3,
     [file: 'lib/dynamic_supervisor.ex', line: 690]},
    {DynamicSupervisor, :handle_start_child, 2,
     [file: 'lib/dynamic_supervisor.ex', line: 676]},
    {:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 661]},
    {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 690]},
    {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}

Can anyone help me please?

Without seeing the start_link signature nor the Dynamic sup code, I imagine that you’re trying to pass a keyword list as the sole argument to the function, if so you need to wrap it in an additional [ ... ] otherwise, since keyword lists are themselves lists of the form [{…, …}, {…, …}, …] it gets interpreted as 2 arguments, {:clearance_id, "clearance_id"} and {:status, "status"}.

hey there,
This is the start_link of the worker:
def start_link([clearance_id: clearance_id, status: status]) do
GenServer.start_link(MODULE, [clearance_id: clearance_id, status: status],
name: String.to_atom(clearance_id)

This is the dynamic supervisors.start_child function:

def start_child(clearance_id) do
child_spec = %{
id: “Fetcher-” <> clearance_id,
start: {Fetcher, :start_link, [clearance_id: clearance_id, status: “APPROVED”]},
restart: :transient,
shutdown: 300_000

DynamicSupervisor.start_child(__MODULE__, child_spec)


Try to wrap the args, as I mentioned: so [[clearance_id: clearance_id, status: “APPROVED”]] instead of single brackets.

Thank you so much, it did the job!

1 Like