sequelize/sequelize · error · Error

GeoJSON Point object ${util.inspect(value)} has an invalid o

Error message

GeoJSON Point object ${util.inspect(value)} has an invalid or missing "type" property. Expected "Point".

What it means

Thrown by assertIsGeoJsonPoint when validating a GeoJSON Point geometry bound for a Sequelize GEOGRAPHY/GEOMETRY column. The object's `type` field must be exactly the string "Point"; missing it, misspelling it (e.g. "point", "POINT"), or carrying the wrong geometry type trips this guard before the value is inlined into SQL. Because coordinates are spliced unescaped into the query (see the SQL-injection note in validatePosition), Sequelize refuses to emit geometry it cannot positively identify.

Source

Thrown at packages/core/src/geo-json.ts:135

        `GeoJSON ${source.type} object ${util.inspect(source)} specifies an invalid point: ${util.inspect(tuple)}. ${util.inspect(coordinate)} is not a numeric value.`,
      );
    }
  }
}

function assertIsBaseGeoJson(value: unknown): asserts value is GeoJson {
  if (!isPlainObject(value)) {
    throw new Error(
      `${util.inspect(value)} is not a valid GeoJSON object: it must be a plain object.`,
    );
  }
}

export function assertIsGeoJsonPoint(value: unknown): asserts value is GeoJsonPoint {
  assertIsBaseGeoJson(value);

  if (value.type !== 'Point') {
    throw new Error(
      `GeoJSON Point object ${util.inspect(value)} has an invalid or missing "type" property. Expected "Point".`,
    );
  }

  const coordinates = value.coordinates;
  // Some Point implementations accepts empty coordinates.
  if (Array.isArray(coordinates) && coordinates.length === 0) {
    return;
  }

  validatePosition(coordinates, value);
}

export function assertIsGeoJsonLineString(value: unknown): asserts value is GeoJsonLineString {
  assertIsBaseGeoJson(value);

  if (value.type !== 'LineString') {
    throw new Error(

View on GitHub (pinned to 7e1deec499)

Solutions

  1. Ensure the object literal includes `type: 'Point'` exactly (capital P).
  2. If you hold coordinates only, wrap them: `{ type: 'Point', coordinates: [lng, lat] }`.
  3. If ingesting external JSON, normalize the `type` field before persisting.
  4. Run assertIsGeoJsonPoint(value) in dev/test to catch shape errors early.

Example fix

// before
await City.create({ loc: { coordinates: [4.9, 52.37] } });
// after
await City.create({ loc: { type: 'Point', coordinates: [4.9, 52.37] } });
Defensive patterns

Strategy: type-guard

Validate before calling

import { assertIsGeoJsonPoint } from '@sequelize/core/_non-semver-used-for-error-messages';
assertIsGeoJsonPoint(value);

Type guard

function isGeoJsonPoint(v: unknown): v is { type: 'Point'; coordinates: number[] | [] } {
  return !!v && typeof v === 'object' && (v as any).type === 'Point';
}

Try / catch

try { assertIsGeoJsonPoint(value); await Model.create({ col: value }); } catch (e) { if (/Expected "Point"/.test(String(e))) { /* normalize type and retry */ } else throw e; }

Prevention

When it happens

Trigger: Passing `{ coordinates: [1,2] }` (no type), `{ type: 'point', coordinates: [1,2] }` (wrong case), or `{ type: 'LineString', coordinates: [[1,2]] }` to a Point column via Model.create / update / a where filter on a spatial attribute. Also fires if a raw DB row is round-tripped through a transformation that strips/relabels `type`.

Common situations: JSON deserialized from an API that omits `type`; using lowercase geometry names from a non-RFC-7946 source; copy-pasting a coordinate-only array where an object was expected; mixing GeoJSON from Mapbox/PostGIS which may emit differing casing.

Related errors


AI-assisted analysis of sequelize/sequelize@7e1deec499 (2026-08-03). Data as JSON: /data/errors/251832084b036c2f.json. Report an issue: GitHub.