{"record":{"id":"4d3d01a4e30b7027","repo":"a-b-street/abstreet","slug":"can-t-end-at-for","errorCode":null,"errorMessage":"can't end at {} for {:?}","messagePattern":"can't end at (.+?) for (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"sim/src/make/spawner.rs","lineNumber":334,"sourceCode":"    constraints: PathConstraints,\n    map: &Map,\n) -> Result<DrivingGoal> {\n    match endpt {\n        TripEndpoint::Building(b) => Ok(DrivingGoal::ParkNear(b)),\n        // TODO Duplicates some logic from TripEndpoint::pos\n        TripEndpoint::Border(i) => map\n            .get_i(i)\n            .some_incoming_road(map)\n            .and_then(|dr| {\n                let lanes = dr.lanes(constraints, map);\n                if lanes.is_empty() {\n                    None\n                } else {\n                    // TODO ideally could use any\n                    Some(DrivingGoal::Border(dr.dst_i(map), lanes[0]))\n                }\n            })\n            .ok_or_else(|| anyhow!(\"can't end at {} for {:?}\", i, constraints)),\n        TripEndpoint::SuddenlyAppear(_) => unreachable!(),\n    }\n}\n","sourceCodeStart":316,"sourceCodeEnd":338,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/sim/src/make/spawner.rs#L316-L338","documentation":"driving_goal builds the destination for the driving leg of a trip. For a TripEndpoint::Border, it resolves the border's destination intersection and the first drivable lane; for buildings it pathfinds via PathConstraints-based access. When no suitable driving lane/goal can be produced under the vehicle's PathConstraints, this anyhow error is raised with the endpoint and constraints.","triggerScenarios":"maybe_new schedules a driving trip whose TripEndpoint::Border(i) has no drivable lanes under the given PathConstraints, or a building endpoint yields no parking/driveway path under those constraints, so the option chain returns None.","commonSituations":"Border with only bus/bike lanes and no car-accessible lane; cars-only or bikes-only constraint sets applied to endpoints that don't support that mode; map edits that removed road access to a building or border.","solutions":["Check the endpoint's lanes and PathConstraints — ensure the border has at least one drivable lane under the constraints used.","Rebuild the map if recent OSM/map edits broke driving access to the endpoint.","Choose a different TripEndpoint or fall back to a walking/transit trip when driving access is impossible.","Inspect the constraints value in the message and align it with the vehicle type being spawned."],"exampleFix":"// before\n.ok_or_else(|| anyhow!(\"can't end at {} for {:?}\", i, constraints))\n// after: caller validates access before scheduling\nif map.get_i(i).get_outgoing_lanes(PathConstraints::Car).is_empty() {\n    // fall back to a different endpoint or mode\n}","handlingStrategy":"validation","validationCode":"// Check driving access for a border endpoint before scheduling\nfn drivable(endpt: &TripEndpoint, constraints: PathConstraints, map: &Map) -> bool {\n    match endpt {\n        TripEndpoint::Border(i) => !map.get_i(*i).get_outgoing_lanes(constraints).is_empty(),\n        TripEndpoint::Building(b) => map.get_b(*b).get_driving_connection(|l| l != PathConstraints::Bike).is_some() || map.get_b(*b).get_driving_connection(|l| true).is_some(),\n        _ => true,\n    }\n}","typeGuard":null,"tryCatchPattern":"// Catch and fall back to a different mode/endpoint\nmatch maybe_new(...) {\n    Ok(t) => t,\n    Err(e) if e.to_string().contains(\"can't end at\") => {\n        // retry with a fallback endpoint or walking trip\n        fallback_trip(endpt)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Match PathConstraints to the endpoint's actual lane types","Verify borders have car-accessible lanes when generating border-targeted trips","Test trip generation over all borders of a map before bulk runs","Include the constraints value in logs to quickly spot constraint/endpoint mismatches"],"tags":["simulation","routing","driving","map-data"],"backgroundTag":"resource-not-found","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}