kunal saxena
kunal saxena

Reputation: 414

'error {badmatch,{error,enoent}}' occurred executing push_roster command on ejabberd

I am trying to add bulk contacts to user's roster in ejabberd. I am using default Mnesia database with ejabberd. I have created a file sampleRosterFile. In this file contents are

[{"kunal", "localhost", "Friend List", "kunal"},{"Rich", "localhost", "Friend List", "Rich"}]

I am executing command

sudo ejabberdctl push_roster /home/kunal/Projects/demo/sampleRosterFile kunal localhost

But i am getting error

Problem 'error {badmatch,{error,enoent}}' occurred executing the command.
Stacktrace: [{mod_admin_extra,push_roster,3,
                              [{file,"src/mod_admin_extra.erl"},{line,1145}]},
             {ejabberd_commands,execute_command2,2,
                                [{file,"src/ejabberd_commands.erl"},
                                 {line,410}]},
             {ejabberd_ctl,call_command,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,295}]},
             {ejabberd_ctl,try_call_command,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,271}]},
             {ejabberd_ctl,process2,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,220}]},
             {ejabberd_ctl,process,1,
                           [{file,"src/ejabberd_ctl.erl"},{line,205}]},
             {rpc,'-handle_call_call/6-fun-0-',5,
                  [{file,"rpc.erl"},{line,206}]}]

As per recent developments, i have made my roster file to .txt and tried again. but now that is giving me error something related to string

sudo ejabberdctl push_roster /home/kunal/Projects/demo/ejabberd/ebin/sampleRosterFile.txt kunal localhost
Problem 'error function_clause' occurred executing the command.
Stacktrace: [{jid,to_string,[error],[{file,"src/jid.erl"},{line,134}]},
             {mod_admin_extra,build_roster_item,3,
                              [{file,"src/mod_admin_extra.erl"},{line,1200}]},
             {mod_admin_extra,subscribe,8,
                              [{file,"src/mod_admin_extra.erl"},{line,1088}]},
             {mod_admin_extra,subscribe_roster,2,
                              [{file,"src/mod_admin_extra.erl"},{line,1167}]},
             {ejabberd_commands,execute_command2,2,
                                [{file,"src/ejabberd_commands.erl"},
                                 {line,410}]},
             {ejabberd_ctl,call_command,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,295}]},
             {ejabberd_ctl,try_call_command,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,271}]},
             {ejabberd_ctl,process2,3,
                           [{file,"src/ejabberd_ctl.erl"},{line,220}]}]

Need help here.

Upvotes: 1

Views: 3086

Answers (2)

Vipul Pachauri
Vipul Pachauri

Reputation: 78

Earlier code was giving me enoent error, which was correctly pointed out by @Mickaël Rémond It will be helpful to give full path of the roster file.

Next is error function_clause error which mean that no function or signature is matching with my input.

after debugging found that correct file format for push_roster command in mod_admin_extra is

[{<<"admin">>,<<"localhost">>,<<"Friend">>,<<"Admin">>},{<<"anil">>,<<"localhost">>,<<"Friend">>,<<"Anil">>}]

It finally worked.

I found helpful explaination on the blog http://www.techiekunal.in/2016/04/ejabberd-bulk-roster-addition-using-pushroster.html

Upvotes: 2

Micka&#235;l R&#233;mond
Micka&#235;l R&#233;mond

Reputation: 9055

enoent error means the file cannot be found. You likely made a mistake in your command and the roster file cannot be found or the ejabberd user does not have the right to read it.

Upvotes: 5

Related Questions