a-b-street/abstreet · error

Some IndividTrip wasn't associated with a Person?!

Error message

Some IndividTrip wasn't associated with a Person?!

What it means

make_scenario builds People from per-person IndividTrip lists, draining the individ_trips vec into Option slots. Afterward it asserts every Option was consumed (Some means a trip whose person ID never matched a built Person). If any remain, it panics "Some IndividTrip wasn't associated with a Person?!" — an internal consistency invariant of the Soundcast import.

Solutions

  1. Check that _trip.tsv and the person/household files come from the same Soundcast model run.
  2. Inspect which person IDs have orphan trips and either drop those trips or add the missing person during parsing.
  3. Ensure any filtering of people earlier in make_scenario also filters their trips (keep the two lists consistent).
  4. Relax the invariant to a warning that discards orphan trips if lossy import is acceptable.

Example fix

// before
if maybe_t.is_some() {
    panic!("Some IndividTrip wasn't associated with a Person?!");
}
// after
if maybe_t.is_some() {
    warn!("Discarding IndividTrip with no matching Person");
}
Defensive patterns

Strategy: validation

Validate before calling

// Before make_scenario, confirm every trip's person id exists:
let orphans: Vec<_> = trips.iter().filter(|t| !person_ids.contains(&t.person_id)).collect();
assert!(orphans.is_empty(), "{} orphan trips", orphans.len());

Try / catch

// Panics uncatchably; filter trips when filtering people:
let individ_trips: Vec<Option<_>> = /* build */;
// after building people, discard leftovers instead of asserting:
let dropped = individ_trips.iter().filter(|t| t.is_some()).count();

Prevention

When it happens

Trigger: Running make_scenario where the trips input references a person ID absent from the parsed population — e.g. trip rows whose per-id grouping produced a person with no matching household/person record, or trips for IDs skipped earlier during filtering.

Common situations: Inconsistent Soundcast person/trip files (trips referencing people dropped by earlier filters like invalid households); mismatched input file versions where _trip.tsv and person files come from different model runs; parser bugs leaving trip slots unfilled.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at importer/src/soundcast/trips.rs:287

            let destination = &pair[0].destination;
            let origin = &pair[1].origin;
            if destination != origin {
                warn!(
                    "Skipping {:?}, with adjacent trips that warp from {:?} to {:?}",
                    orig_id, destination, origin
                );
                continue;
            }
        }

        people.push(PersonSpec {
            orig_id: Some(orig_id),
            trips,
        });
    }
    for maybe_t in individ_trips {
        if maybe_t.is_some() {
            panic!("Some IndividTrip wasn't associated with a Person?!");
        }
    }

    Scenario {
        scenario_name: scenario_name.to_string(),
        map_name: map.get_name().clone(),
        people,
        only_seed_buses: None,
    }
    .remove_weird_schedules(true)
}

View on GitHub (pinned to 0964f29315)