node_changed_mark failed ERROR

i set up my own mod_tile server and tried to add a special map layer which i created in JOSM.
but whenever i save from JOSM to a OSM file JOSM adds a “action=‘modify’” tag in each node which then
causes osm2pgsql to post the following error:
node_changed_mark failed: ERROR: prepared statement “node_changed_mark” does not exist.
when i remove the “action=‘modify’” tag it is working, but i would like to know where this tag comes from
or what i am doing wrong.



You have modified those object in JOSM, and that’s why they are marked as modified in the saved file.

As you have found out, there’s a subtle difference between a downloaded/exported .osm file and one generated by JOSM. When you have only edited existing objects, you could remove the action=‘modify’ before importing with osm2pgsql.

When you have created objects, they will have a negative ID, and that could be problematic as well, so changing that to a unique positive number might help.

with the negative id i had no problems as long as i removed the “action=‘modify’” tag.
is there any further problem i might encounter when removing this tag ?
or why is this tag added by JOSM ?
or any settings i am missing in the osm2pgsql call:
osm2pgsql -c -d database -U user -W -H host -s osmfile


The tag is added by JOSM so that it knows which changes you made in your osm-copy, to later upload only the changed elements to the server.

so why is osm2pgsql having problems with the “action=‘modify’” entry ?

Because it was never designed to work with the particular version of .osm files that JOSM saves, and it hasn’t been adapted to fully handle them.