Differences between revisions 30 and 31
Revision 30 as of 2013-10-14 17:27:57
Size: 16368
Editor: 82
Revision 31 as of 2013-10-14 17:37:45
Size: 16461
Editor: 82
Deletions are marked like this. Additions are marked like this.
Line 503: Line 503:
'''Solution''' '''Solution / Workaround '''
Line 510: Line 510:
If possible, please file a bug in the bug-tracking system of your Linux distribution. If possible, please examine your SELinux audit log (/var/log/audit/audit.log) and file a bug for this problem in the bug-tracking system of your Linux distribution.

We have a new wiki. The migration is not 100% complete. You can help out by moving pages across. This wiki will exist for as long as there are pages left.

The official documentation has moved to http://docs.couchdb.org — The transition is not 100% complete, but http://docs.couchdb.org should be seen as having the latest info. In some cases, the wiki still has some more or older info on certain topics inside CouchDB.

You need to be added to the ContributorsGroup to edit the wiki. But don't worry! Just email any Mailing List or grab us on IRC and let us know your user name.

Error Messages

Explanation and solution of error messages you may experience while building or running CouchDB.

Formatting error messages

The attached file (whaterr.py) is a quick python script that makes error message easier to use. This could probably be turned into a JS bookmark to make it more widely used.

Usage: ./whaterr.py url

If you have a url that's printing you a horrble painful error message, (especially mustache errors),
this util prints it in a slightly less painful way.

eg. ./whaterr.py http://localhost:5984/dbname/_design/designname/_list/listname/viewname
eg. ./whaterr.py http://localhost:5984/footprint/_design/footprint/_list/products/products

Installation errors

Missing icu-config


*** The icu-config script could not be found. Make sure it is
*** in your path, and that taglib is properly installed.
*** Or see http://ibm.com/software/globalization/icu/


Install ICU and use locate to find the icu-config command:

locate icu-config

For me on Ubuntu 8.04 server I just did:

sudo apt-get install libicu-dev

Take the directory from the output of this command and add it to your PATH:

export PATH="$PATH:/usr/local/bin"

Erlang version is less than 5.6.5 (R12B)


Even after doing sudo apt-get install erlang you are getting the following error on ubuntu 8.04:

configure: error: The installed Erlang version is less than 5.6.5 (R12B).


To get a later version without bothering with installing from source edit /etc/apt/sources.list and locate the following line:

deb http://us.archive.ubuntu.com/ubuntu/ hardy universe

Change it to the following

deb http://us.archive.ubuntu.com/ubuntu/ intrepid universe

Save and then run:

apt-get update

You should now be able to install it by doing:

apt-get install erlang-nox erlang-dev

Test you version and confirm you see something greater than 5.6.0




$ couchdb      
Apache CouchDB 0.8.0-incubating (LogLevel=info)
Apache CouchDB is starting.

{"init terminating in do_boot",{error,{open_error,-10}}​}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()


$ couchdb
Apache CouchDB 0.8.1-incubating (LogLevel=info)
Apache CouchDB is starting.

{"init terminating in do_boot","libjs.so: cannot open shared object file: No such file or directory"}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (libjs.so: cannot open shared object file: No such file or directory)


You must correctly set your LD_LIBRARY_PATH environment variable so that it picks up your installed libraries. On Mac OS X, the equivalent variable is DYLD_LIBRARY_PATH.

Example running as normal user:

LD_LIBRARY_PATH=/usr/local/lib:/usr/local/spidermonkey/lib couchdb

Example running as couchdb user:

echo LD_LIBRARY_PATH=/usr/local/lib:/usr/local/spidermonkey/lib couchdb | sudo -u couchdb sh

Similar instructions are on the InstallingSpiderMonkey page.

Binary Architecture Mismatch OSX

On Mac OS X, libraries and executables can be fat binaries that support multiple processor architectures (PPC and x86, 32 and 64 bit). But that also means you will run into problems when trying to load a library into an application if that library doesn't support the architecture used by the application process.


$ couchdb      
Apache CouchDB 0.8.0-incubating (LogLevel=info)
Apache CouchDB is starting.

{"init terminating in do_boot",{error,{open_error,-12}}​}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()


You've probably built Erlang with the 64 bit option enabled. The problem is that ICU, which CouchDB attempts to load at startup time, has not been compiled with 64 bit support, so it can't be loaded into the 64bit Erlang process.

For now you'll have to recompile Erlang, and resist the temptation to build a 64 bit binary (just omit the --enable-darwin-64bit option). The --enable-darwin-universal option works okay, but note that currently there's no universal build of ICU available.

Binary Architecture Mismatch Solaris/SPARC


Apache CouchDB 0.8.1-incubating (LogLevel=info)
Apache CouchDB is starting.

{"init terminating in do_boot","ld.so.1: beam.smp: fatal: relocation
error: file
symbol ucol_close_4_0: referenced symbol not found"}
init terminating in do_boot (ld.so.1: beam.smp: fatal: relocation error:
symbol ucol_close_4_0: r


Solaris provides an old version of the ICU library. On SPARC hardware, when building the current version of ICU, it defaults to 64bits, while erlang and spidermonkey defaulted to 32bit, so when linking, the linker picks the outdated version.

The solution is to rebuild ICU for 32bits. At the ./configure step, add this flag, "--enable-64bit-libs=no".

Also, use LD_LIBRARY_PATH or crle to make /usr/local/lib earlier in the search path than /usr/lib.

Unavailable Port


$ couchdb      
Apache CouchDB 0.9.0a747640 (LogLevel=info) is starting.
Failure to start Mochiweb: eaddrinuse
{"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}


Edit your /etc/couchdb/couch.ini file and change the Port setting to an available port.


"Failure to start Mochiweb: ~s~n"


You're trying to start CouchDB on port 80, but the user (couchdb) is not allowed to run on port 80. Change the user a privileged account (e.g. root).

Missing OpenSSL


$ bin/couchdb
Apache CouchDB 0.8.0-incubating (LogLevel=info)
Apache CouchDB is starting.                                                                       

{"init terminating in do_boot",{undef,[{crypto,start,[]},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}}  

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()


You are missing erlang SSL support.

You may not have installed the package that provides it (for example, erlang-ssl). Check $(libdir)/erlang/lib/ssl-*/ and make sure it contains more than just an include/ subdirectory.

If you compiled by hand, you need to install the OpenSSL libraries and recompile Erlang with SSL enabled.

Incorrect Permissions or Missing Directories


$ bin/couchdb
Apache CouchDB 0.9.0a691361-incubating (LogLevel=info) is starting.
{"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()


You need to make sure that the user running couchdb has permissions to write to /usr/local/var/lib/couchdb and /usr/local/var/log/couchdb. This error message may also appear if CouchDB is trying to bind to a port that is already in use.

Also check that the directories specified in your local.ini are there, like the database_dir and the directory where the log file is created. If they are not there, create them.

Crash On Startup


$ sudo couchdb
Apache CouchDB 0.9.0a720049-incubating (LogLevel=info) is starting.
{"init terminating in do_boot","Driver is an inappropriate Mach-O file"}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (Driver is an inappropriate Mach-O file)


This is related to an update made in erlang (http://www.nabble.com/OS-X-fixes-(HiPE,-ddll-unload)-td19411880.html) Upgrading to version R12B-5 or higher should fix things.

Mac Port of Erlang fails to configure on Snow Leopard

Problem During the installation of erlang, the installer fails during the configuration step:

configure: error: /bin/sh =
rts.org_release_ports_lang_erlang/work/erlang-R13B02/erts/configure' =
failed for ertsError: Status 1 =
encountered during processing

Solution Install the non-universal build of erlang separately before couchdb:

sudo port install erlang -universal
sudo port install couchdb

Failed start up error

Problem I got this error on gentoo:

=SUPERVISOR REPORT==== 14-Sep-2010::06:34:21 ===
     Supervisor: {local,couch_server_sup}
     Context:    start_error
     Reason:     shutdown
     Offender:   [{pid,undefined},

=CRASH REPORT==== 14-Sep-2010::06:34:21 ===
    initial call: application_master:init/4
    pid: <0.32.0>
    registered_name: []
    exception exit: {bad_return,
                               {application_master,start_it_old,4}] } } } }
      in function  application_master:init/4
    ancestors: [<0.31.0>]
    messages: [{'EXIT',<0.33.0>,normal}]
    links: [<0.31.0>,<0.7.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 987
    stack_size: 24
    reductions: 115

=INFO REPORT==== 14-Sep-2010::06:34:21 ===
    application: couch
    exited: {bad_return,{{couch_app,start,
                                   {application_master,start_it_old,4}]} } } }
    type: temporary

I surmise the problem is that once you've run couchdb as root once, it mucks up all the file ownerships so you can't run it as the couchdb user again.

Solution 1 So my fix was to totally delete it all and start again, like this (running as root):

/etc/init.d/couchdb stop
killall -9 couchdb
killall -9 beam
emerge --unmerge couchdb
rm -rf /etc/conf.d/couchdb
rm -rf /etc/couchdb
rm -rf /etc/default/couchdb
rm -rf /etc/init.d/couchdb
rm -rf /etc/logrotate.d/couchdb
rm -rf /usr/bin/couchdb
rm -rf /usr/bin/couchjs
rm -rf /usr/lib/couchdb
rm -rf /usr/share/couchdb
rm -rf /usr/share/doc/couchdb-0.10.1
rm -rf /usr/share/man/man1/couchdb.1.bz2
rm -rf /usr/share/man/man1/couchjs.1.bz2
rm -rf /var/lib/couchdb
rm -rf /var/log/couchdb
rm -rf /var/run/couchdb
userdel couchdb
/etc/init.d/couchdb start

That's basically a mega uninstall and re-install.

You might be able to do it with some:

chown couchdb:couchdb -R ...

If you really can't loose whatever data and configs you have .. or you could back them up first :)

Solution 2 I've got the same error on Ubuntu, it turned out to be a permissions issue for the log file ("/var/log/couchdb/couch.log" as specified in default.ini). You can adjust permissions/ownership for the file or override log file location in local.ini (or in your favorite file in the config chain):

file = /home/couchdb/log/couch.log

Runtime Errors

function raised exception (Cannot encode 'undefined' value as JSON)


A view index fails to build, CouchDB Logs this error message:

function raised exception (Cannot encode 'undefined' value as JSON)


The JavaScript code you are using for the map or reduce function is using an object member that is not defined. Consider this document


And this map function:

function(doc) {
  emit(doc.name, doc.address);

Use guarding to make sure to only access members when they exist in the passed-in document:

function(doc) {
  if(doc.name && doc.address) {
      emit(doc.name, doc.address);

While the above guard will work in most cases, it's worth bearing JavaScript's falsy set of values in mind. Testing against a property with a value of 0 (zero), '' (empty String), false or null will return false. If this is undesired a guard of the form if (doc.foo !== undefined) should do the trick.

This error can also be caused if a reduce function does not return a value. For example, this reduce function will cause an error:

function(key, values) {

The function needs to return a value:

function(key, values) {
  return sum(values);

replication received exception ({"error":"badmatch","reason":"{error,already_present}"})


A replication request receives the following HTTP response

HTTP/1.1 500 Internal Server Error - {"error":"badmatch","reason":"{error,already_present}"}


Alas, there is no information about this at present - it is being looked into. Observed on a 0.9 release running on x86_64 Linux

OS Process Error {os_process_error,{exit_status,127}}


When using any of the query server functionality (views, shows, lists, update functions, changes filters, validations) you see:

… OS Process Error … {os_process_error,{exit_status,127}}


Your Spidermonkey installation is not correct, this usually happens on Ubuntu, Installing on Ubuntu for all the details.

OS Process Error {os_process_error,{exit_status,139}}


On a system that has SELinux enabled the following error can occur.

… OS Process Error … {os_process_error,{exit_status,139}}

This is caused by the fact that SELinux blocks access to certain areas of the filesystem.

Solution / Workaround

Disable SELinux using the command

setenforce 0

If possible, please examine your SELinux audit log (/var/log/audit/audit.log) and file a bug for this problem in the bug-tracking system of your Linux distribution.

erlang stack trace contains '''bad_utf8_character_code'''

CouchDB 1.1.1 and later contains stricter handling of UTF8 encoding. If you are replicating from older versions to newer versions, then this error may occur during replication.

A number of work-arounds exist; the simplest is to do an in-place upgrade of the relevant CouchDB and then compact prior to replicating.

Alternatively, if the number of documents impacted is small, use filtered replication to exclude only those documents.


TODO: // confirm the above works //

Error_messages (last edited 2016-08-27 08:03:51 by JoanTouzet)