This error message basically tells you that the geometry column in the database is not a 3D geometry (it doesn't have the Z value), hence you have to create, e.g. a POINTZ instead of a POINT. Same goes for LINESTRING and POLYGON and their "MULTI" versions.
28.1. 3-D Geometries
So far, we have been working with 2-D geometries, with only X and Y
coordinates. But PostGIS supports additional dimensions on all
geometry types, a “Z” dimension to add height information and a “M”
dimension for additional dimensional information (commonly time, or
road-mile, or upstream-distance information) for each coordinate.
For 3-D and 4-D geometries, the extra dimensions are added as extra
coordinates for each vertex in the geometry, and the geometry type is
enhanced to indicate how to interpret the extra dimensions. Adding the
extra dimensions results in three extra possible geometry types for
each geometry primitive:
Point (a 2-D type) is joined by PointZ, PointM and PointZM types.
Linestring (a 2-D type) is joined by LinestringZ, LinestringM and LinestringZM types.
Polygon (a 2-D type) is joined by PolygonZ, PolygonM and PolygonZM types.
And so on.
Source: the PostGIS documentation for all the details: https://postgis.net/workshops/postgis-intro/3d.html
For example, create a table for storing 3D point geometries as:
CREATE TABLE my_table (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
geom geometry(POINTZ, 3857) -- for storing 3D point geometries
);
Instead of:
CREATE TABLE my_table (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
geom geometry(POINT, 3857) -- for storing 2D point geometries
);
Notice the removal of the trailing Z.
See also the PostGIS documentation chapter 4.6.1. Creating a Spatial Table.