{"id":"251832084b036c2f","repo":"sequelize/sequelize","slug":"geojson-point-object-util-inspect-value-has-an","errorCode":null,"errorMessage":"GeoJSON Point object ${util.inspect(value)} has an invalid or missing \"type\" property. Expected \"Point\".","messagePattern":"GeoJSON Point object (.+?) has an invalid or missing \"type\" property\\. Expected \"Point\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/geo-json.ts","lineNumber":135,"sourceCode":"        `GeoJSON ${source.type} object ${util.inspect(source)} specifies an invalid point: ${util.inspect(tuple)}. ${util.inspect(coordinate)} is not a numeric value.`,\n      );\n    }\n  }\n}\n\nfunction assertIsBaseGeoJson(value: unknown): asserts value is GeoJson {\n  if (!isPlainObject(value)) {\n    throw new Error(\n      `${util.inspect(value)} is not a valid GeoJSON object: it must be a plain object.`,\n    );\n  }\n}\n\nexport function assertIsGeoJsonPoint(value: unknown): asserts value is GeoJsonPoint {\n  assertIsBaseGeoJson(value);\n\n  if (value.type !== 'Point') {\n    throw new Error(\n      `GeoJSON Point object ${util.inspect(value)} has an invalid or missing \"type\" property. Expected \"Point\".`,\n    );\n  }\n\n  const coordinates = value.coordinates;\n  // Some Point implementations accepts empty coordinates.\n  if (Array.isArray(coordinates) && coordinates.length === 0) {\n    return;\n  }\n\n  validatePosition(coordinates, value);\n}\n\nexport function assertIsGeoJsonLineString(value: unknown): asserts value is GeoJsonLineString {\n  assertIsBaseGeoJson(value);\n\n  if (value.type !== 'LineString') {\n    throw new Error(","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/sequelize/sequelize/blob/7e1deec499d5afbb8d1877c2f4d545cead1214ec/packages/core/src/geo-json.ts#L117-L153","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Ensure the object literal includes `type: 'Point'` exactly (capital P).","If you hold coordinates only, wrap them: `{ type: 'Point', coordinates: [lng, lat] }`.","If ingesting external JSON, normalize the `type` field before persisting.","Run assertIsGeoJsonPoint(value) in dev/test to catch shape errors early."],"exampleFix":"// before\nawait City.create({ loc: { coordinates: [4.9, 52.37] } });\n// after\nawait City.create({ loc: { type: 'Point', coordinates: [4.9, 52.37] } });","handlingStrategy":"type-guard","validationCode":"import { assertIsGeoJsonPoint } from '@sequelize/core/_non-semver-used-for-error-messages';\nassertIsGeoJsonPoint(value);","typeGuard":"function isGeoJsonPoint(v: unknown): v is { type: 'Point'; coordinates: number[] | [] } {\n  return !!v && typeof v === 'object' && (v as any).type === 'Point';\n}","tryCatchPattern":"try { assertIsGeoJsonPoint(value); await Model.create({ col: value }); } catch (e) { if (/Expected \"Point\"/.test(String(e))) { /* normalize type and retry */ } else throw e; }","preventionTips":["Always set type when constructing geometry literals","Normalize external GeoJSON casing at the API boundary","Add a unit test that round-trips representative geometries through the assert"],"tags":["geojson","validation","spatial","sequelize","geometry"],"analyzedSha":"7e1deec499d5afbb8d1877c2f4d545cead1214ec","analyzedAt":"2026-08-03T18:58:44.549Z","schemaVersion":2}