osm2pgsql error

Dear all
When I execute following command to import the map data.

osm2pgsql --slim -c -d gis -C 600 --number-processes 3 ~/planet/taiwan-latest.osm.pbf

The error occurs

pthread_join() returned exception: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::current_exception_std_exception_wrapper<std::runtime_error> >
std::exception::what: CREATE TABLE planet_osm_roads_tmp  AS SELECT * FROM planet_osm_roads ORDER BY CASE WHEN ST_IsEmpty(way) THEN NULL ELSE ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10) END failed: ERROR:  GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys

[boost::tag_original_exception_type*] = St13runtime_error

Error occurred, cleaning up

I search the answer long time and can’t find the solution.
Can someone give me a suggestion to solve the problem?

The last part of the error “Cannot find SRID (4326) in spatial_ref_sys” is probably the most useful to go searching with, see for example:


It might also help to say what OS you’re running on and where you got osm2pgsql from, what version is it and how you built it (if you did build it yourself). Also what you did to create and prepare the database that you’re working with.

Dear SomeoneElse
Thanks for your reply.
According to https://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/
I run on Ubuntu Linux 12.04 LTS, use following command to get osm2pgsql、compile and run.
Can you explain more about the link you provide? I use the suggestion “spatialreference.org/ref/epsg/4326/postgis” from the link you provide.
But the error is still occurs.
thanks your very much

mkdir ~/src
cd ~/src
git clone git://github.com/openstreetmap/osm2pgsql.git
cd osm2pgsql
sudo make install
psql -f /usr/local/share/osm2pgsql/900913.sql -d gis

That list looks exactly like what I did to set things up on Ubuntu 12.04 when I last tried it about 3 years ago (but using git instead of svn). There have been changes to many things in the switch2osm 12.04 instructions since when I tried it of course - did any of the response to those commands suggest that something didn’t work, including the postgres/postgis setup?

The installation was very successful when I setup postgres/postgis.
I think it maybe the problem of osm2pgsql.How can I get elder version of osm2pgsql?

There are a bunch of releases on this page:


If you want to build based on how things were on a certain date, have a read of this:


But note that it’s not just osm2pgsql that’s changed in the last 3 years - postgres et al will have too.

I ran into a similar error during an OSM import. I think the problem is here:

postgres$ psql -f /usr/local/share/osm2pgsql/900913.sql -d gis

Instead, import all the spatial reference systems from PostGIS:

postgres$ psql -d gis -f /usr/share/postgresql/9.4/contrib/postgis-2.1/spatial_ref_sys.sql

That path may be different for you depending on your version of PostgreSQL or OS. If you already did the import of 900913, you can remove it:

postgres$ psql -d gis
=> TRUNCATE spatial_ref_sys;

And then import all the spatial reference systems. I am doing a partial planet import so I won’t know if it works for another day or two.