a-b-street/abstreet · error · anyhow::Error

snapped to sidewalk , but no driving connection

Error message

snapped to sidewalk {}, but no driving connection

What it means

After snapping the parking lot center to a sidewalk point, snap_driveway tries to build a drivable polyline from the lot to a road/driving position. If every candidate path fails to map to a driving connection, the Ok value is None and this error is thrown naming the sidewalk lane. The sidewalk snap succeeded, but a car-accessible driveway could not be routed.

Solutions

  1. Check that the sidewalk's adjacent road has driving lanes in the imported map
  2. Relax or retry with alternative candidate driving positions instead of requiring one polyline
  3. Skip the lot with a warning instead of erroring the whole import
  4. Re-import the map verifying the road network around the lot is connected

Example fix

// before
let (driveway_line, driving_pos) = driveway.ok_or_else(|| anyhow!("snapped to sidewalk {}, but no driving connection", sidewalk_pos.lane()))?;
// after
let (driveway_line, driving_pos) = match driveway {
    Some(v) => v,
    None => {
        warn!("lot snapped to {} but no driving connection; skipping", sidewalk_pos.lane());
        return Ok(None);
    }
};
Defensive patterns

Strategy: fallback

Validate before calling

// confirm the snapped sidewalk's road has driving lanes
let road = map.get_parent(sidewalk_pos.lane());
if !road.lanes.iter().any(|l| l.lt == LaneType::Driving) {
    warn!("sidewalk lane {} has no driving lanes", sidewalk_pos.lane());
}

Try / catch

match snap_driveway(...) { Err(e) if e.to_string().starts_with("snapped to sidewalk") => { warn!("no driveway: {}", e); Ok(None) }, r => r }

Prevention

When it happens

Trigger: Calling make_all_parking_lots or fix_parking_lot_driveways where the trim_path / path-to-driving-lane construction returns None for all candidates — e.g. the snapped sidewalk's nearest driving lane is unreachable or geometry construction (PolyLine::new) fails.

Common situations: Lots whose snapped sidewalk is on a road with no driving lanes (pedestrian-only streets); disconnected road graphs after import; one-way or service-road configurations that leave the snapped lane without a drivable link.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13). Data as JSON: /api/errors/49de8f8c212ffc60. Report an issue: GitHub.

Appendix: source

Thrown at map_model/src/make/parking_lots.rs:172

    if let Some(driving_pos) = map
        .get_parent(sidewalk_lane)
        .find_closest_lane(sidewalk_lane, |l| PathConstraints::Car.can_use(l, map))
        .and_then(|l| {
            sidewalk_pos
                .equiv_pos(l, map)
                .buffer_dist(driveway_buffer, map)
        })
    {
        if let Ok(pl) = PolyLine::new(vec![
            sidewalk_line.pt1(),
            sidewalk_line.pt2(),
            driving_pos.pt(map),
        ]) {
            driveway = Some((pl, driving_pos));
        }
    }
    let (driveway_line, driving_pos) = driveway.ok_or_else(|| {
        anyhow!(
            "snapped to sidewalk {}, but no driving connection",
            sidewalk_pos.lane()
        )
    })?;
    Ok((driveway_line, driving_pos, sidewalk_line, *sidewalk_pos))
}

fn infer_spots(lot_polygon: &Polygon, aisles: &[Vec<Pt2D>]) -> Vec<(Pt2D, Angle)> {
    let mut spots = Vec::new();
    let mut finalized_lines = Vec::new();

    for aisle in aisles {
        let aisle_thickness = NORMAL_LANE_THICKNESS / 2.0;
        let pl = PolyLine::unchecked_new(aisle.clone());

        for rotate in [90.0, -90.0] {
            // Blindly generate all of the lines
            let lines = {

View on GitHub (pinned to 0964f29315)