{"record":{"id":"fda233d853abccbe","repo":"a-b-street/abstreet","slug":"person-has-a-trip-from-to-the-same-place","errorCode":null,"errorMessage":"Person ({:?}) has a trip from/to the same place: {:?}","messagePattern":"Person \\((.+?)\\) has a trip from/to the same place: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"synthpop/src/scenario.rs","lineNumber":199,"sourceCode":"            if pair[0].destination != pair[1].origin {\n                // Exiting one border and re-entering another is fine\n                if matches!(pair[0].destination, TripEndpoint::Border(_))\n                    && matches!(pair[1].origin, TripEndpoint::Border(_))\n                {\n                    continue;\n                }\n                bail!(\n                    \"Person ({:?}) warps from {:?} to {:?} during adjacent trips\",\n                    self.orig_id,\n                    pair[0].destination,\n                    pair[1].origin\n                );\n            }\n        }\n\n        for trip in &self.trips {\n            if trip.origin == trip.destination {\n                bail!(\n                    \"Person ({:?}) has a trip from/to the same place: {:?}\",\n                    self.orig_id,\n                    trip.origin\n                );\n            }\n        }\n\n        Ok(())\n    }\n}\n","sourceCodeStart":181,"sourceCodeEnd":210,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/synthpop/src/scenario.rs#L181-L210","documentation":"check_schedule rejects any individual trip whose origin and destination are the same endpoint, since a trip from a place to itself is meaningless in the model. The error names the person and the offending origin.","triggerScenarios":"A trip in the PersonSpec has origin == destination, often produced when an activity generator emits a return-to-same-place leg or import deduplicates endpoints incorrectly.","commonSituations":"Round-trip data recorded as a single degenerate trip, activity models emitting zero-length trips for same-building activities (related to the home==work TODO), noisy GPS-derived trips.","solutions":["Drop trips with identical origin and destination before check_schedule","Split them into meaningful legs or convert the person to stay-at-home with no trips (then filter per error 175)","Fix the upstream generator/importer that emits degenerate trips"],"exampleFix":"// before\ntrips.retain(|t| true);\n// after\ntrips.retain(|t| t.origin != t.destination);","handlingStrategy":"validation","validationCode":"person.trips.retain(|t| t.origin != t.destination);","typeGuard":null,"tryCatchPattern":"match person.check_schedule() {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"same place\") => {\n        person.trips.retain(|t| t.origin != t.destination);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter degenerate same-origin trips at import time","Fix upstream generators that emit zero-length trips","Re-run check_schedule after any filtering to catch the resulting empty-trips case"],"tags":["synthpop","scenario","validation"],"backgroundTag":"schema-validation-failed","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"}