Skip to content

Emit warning when osrm-extract encounters ways referencing missing nodes#7351

Open
afarber wants to merge 3 commits intoProject-OSRM:masterfrom
afarber:1596-emit-warning-missing-nodes
Open

Emit warning when osrm-extract encounters ways referencing missing nodes#7351
afarber wants to merge 3 commits intoProject-OSRM:masterfrom
afarber:1596-emit-warning-missing-nodes

Conversation

@afarber
Copy link
Contributor

@afarber afarber commented Feb 8, 2026

Issue

Fixes #1596

When an OSM file has <way> elements referencing <node> elements that don't exist, osrm-extract processes the file silently. Users get no indication their input data has problems, making it difficult to diagnose issues in later pipeline stages.

The extractor already handles this correctly at the code level -- PrepareNodes() filters out missing node references and PrepareEdges() marks edges with invalid nodes as SPECIAL_NODEID. However, the existing debug-level messages are only visible with --verbosity DEBUG.

This PR adds a logWARNING that is visible at the default log level.

Missing boundary nodes are expected for bounding-box extracts, so extraction still succeeds -- the warning simply informs the user about the count of dropped nodes.

Tasklist

Requirements / Relations

None

Copy link
Collaborator

@DennisOSRM DennisOSRM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me. I think I remember a discussion on the topic where someone raised a concern that this could turn into log spewing on planet files.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a user-visible warning during extraction when OSM <way> elements reference missing <node> elements, improving diagnosability of malformed or clipped input data while keeping extraction successful.

Changes:

  • Emit a logWARNING in ExtractionContainers::PrepareNodes() reporting how many referenced nodes were dropped as missing.
  • Add a cucumber step to remove a node from generated OSM test data.
  • Add a new feature test covering the warning behavior, plus a CHANGELOG entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/extractor/extraction_containers.cpp Logs a warning when referenced nodes are missing after node intersection/filtering.
features/step_definitions/data.js Adds a test step to remove a node from the synthetic OSM DB.
features/options/extract/missing_nodes.feature New scenario asserting the warning appears on stderr for missing node references.
CHANGELOG.md Documents the new extraction warning behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@afarber
Copy link
Contributor Author

afarber commented Feb 8, 2026

@DennisOSRM the warning is a single summary line with the count, not per-node, so it shouldn't spam the planet logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

osrm-extract should error on invalid OSM data files

2 participants