Skip to content

Unhandled exception in TransModel API when querying to/from an invalid location #6948

@vpaturet

Description

@vpaturet

The following query:

{
  query: trip(
    to: {place: "", name: ""}
    from: {coordinates: {latitude: 60.193422, longitude: 11.098376}}
    numTripPatterns: 3
    dateTime: "2025-10-08T01:16:07+0200"
    maximumTransfers: 3
    walkSpeed: 1.5
    searchWindow: 1440
    arriveBy: false
  ) {
    routingErrors {
      description
    }
    tripPatterns {
      startTime
      endTime
      duration
      walkDistance

    }
  }
}

fails with the following exception:

Exception while fetching data (/query) : Cannot invoke "org.opentripplanner.routing.api.request.RouteRequest.dateTime()" because "request" is null
java.lang.NullPointerException: Cannot invoke "org.opentripplanner.routing.api.request.RouteRequest.dateTime()" because "request" is null
	at org.opentripplanner.routing.algorithm.mapping.TripPlanMapper.mapTripPlan(TripPlanMapper.java:37)
	at org.opentripplanner.apis.transmodel.TransmodelGraphQLPlanner.plan(TransmodelGraphQLPlanner.java:48)
	at graphql.execution.ExecutionStrategy.invokeDataFetcher(ExecutionStrategy.java:510)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:464)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:404)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:363)
	at graphql.execution.ExecutionStrategy.getAsyncFieldValueInfo(ExecutionStrategy.java:328)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:57)
	at graphql.execution.Execution.executeOperation(Execution.java:205)
	at graphql.execution.Execution.execute(Execution.java:124)
	at graphql.GraphQL.execute(GraphQL.java:549)
	at graphql.GraphQL.lambda$parseValidateAndExecute$13(GraphQL.java:479)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
	at graphql.EngineRunningState.compose(EngineRunningState.java:87)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:474)
	at graphql.GraphQL.lambda$executeAsync$9(GraphQL.java:434)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
	at graphql.EngineRunningState.compose(EngineRunningState.java:87)
	at graphql.GraphQL.lambda$executeAsync$10(GraphQL.java:423)
	at graphql.EngineRunningState.call(EngineRunningState.java:198)
	at graphql.GraphQL.executeAsync(GraphQL.java:416)
	at graphql.GraphQL.execute(GraphQL.java:359)
	at org.opentripplanner.apis.transmodel.TransmodelGraph.executeGraphQL(TransmodelGraph.java:69)
	at org.opentripplanner.apis.transmodel.TransmodelAPI.getGraphQL(TransmodelAPI.java:104)

In previous versions of OTP, it used to succeed and return and empty result together with a routing error:

{
  "data": {
    "query": {
      "routingErrors": [
        {
          "description": "Destination is unknown.  Can you be a bit more descriptive?"
        }
      ],
      "tripPatterns": []
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    !BugApply to issues describing a bug and PRs witch fixes it.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions