How to fix the 'RPC to riak@<address>' failed error

by Kasper Tidemann

Riak version 1.3.0 was released a couple of days ago and it contains a very exciting set of new features. You’ve probably already upgraded by now – congratulations!

If you make use of Riak Search by using the search-cmd in the terminal, you might be seeing this error when attempting to perform a search for something:

$ search-cmd search bucket "some_property:some_value"

 :: Searching for 'some_property:some_value' / '' in bucket...

------------------------------

RPC to 'riak@127.0.0.1' failed: {'EXIT',
    {badarg,
    [{ets,lookup,[schema_table,<<"bucket">>],[]},
    {riak_search_config,get_schema,1,
    [{file,"src/riak_search_config.erl"},
    {line,69}]},
    {riak_search_client,parse_query,3,
    [{file,"src/riak_search_client.erl"},
    {line,40}]},
    {search,search,3,
    [{file,"src/search.erl"},{line,52}]},
    {riak_search_cmd,search,3,
    [{file,"src/riak_search_cmd.erl"},
    {line,188}]},
    {rpc,'-handle_call_call/6-fun-0-',5,
    [{file,"rpc.erl"},{line,203}]}]}}

That’s a somewhat cryptic error that looks like something is fatally wrong. But don’t worry, it’s just caused by Riak Search not being enabled in your app.config file.

First of all, locate your app.config file. If you’ve installed via Homebrew, this will be located at /usr/local/Cellar/riak/1.3.0-x86_64/libexec/etc/app.config.

Then, change line 193 from being {enabled, false} to {enabled, true}, restart Riak and everything will work again.

(In general, whenever you upgrade Riak, be sure to port over the options you’ve previously configured – otherwise you’ll risk seeing some unexpected behavior.)