{"record":{"id":"31ce8fd7c1208a83","repo":"a-b-street/abstreet","slug":"unknown-command","errorCode":null,"errorMessage":"Unknown command","messagePattern":"Unknown command","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"headless/src/main.rs","lineNumber":418,"sourceCode":"        }\n        \"/map/get-intersection-geometry\" => {\n            let i = IntersectionID(get(\"id\")?.parse::<usize>()?);\n            Ok(abstutil::to_json(&export_geometry(map, i)))\n        }\n        \"/map/get-all-geometry\" => Ok(abstutil::to_json(&map.export_geometry())),\n        \"/map/get-nearest-road\" => {\n            let pt = LonLat::new(get(\"lon\")?.parse::<f64>()?, get(\"lat\")?.parse::<f64>()?);\n            let mut closest = FindClosest::new();\n            for r in map.all_roads() {\n                closest.add(r.id, r.center_pts.points());\n            }\n            let threshold = Distance::meters(get(\"threshold_meters\")?.parse::<f64>()?);\n            match closest.closest_pt(pt.to_pt(map.get_gps_bounds()), threshold) {\n                Some((r, _)) => Ok(r.0.to_string()),\n                None => bail!(\"No road within {} of {}\", threshold, pt),\n            }\n        }\n        _ => Err(anyhow!(\"Unknown command\")),\n    }\n}\n\n// TODO I think specifying the API with protobufs or similar will be a better idea.\n\n#[derive(Serialize)]\nstruct FinishedTrip {\n    id: TripID,\n    person: PersonID,\n    duration: Option<Duration>,\n    distance_crossed: Distance,\n    mode: TripMode,\n}\n\n#[derive(Serialize)]\nstruct Delays {\n    #[serde(serialize_with = \"serialize_btreemap\")]\n    per_direction: BTreeMap<MovementID, Vec<Duration>>,","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/headless/src/main.rs#L400-L436","documentation":"The catch-all arm of handle_command's match on the request path returns Err(anyhow!(\"Unknown command\")) for any path that is not one of the recognized headless API routes. It signals the client called an endpoint this server does not implement.","triggerScenarios":"HTTP request to a path not in handle_command's match list (e.g. /sim/ffwd typo'd as /sim/fastforward, wrong trailing slash, or an endpoint added on the client but not the server).","commonSituations":"API contract drift between client and headless server version; typos in endpoint paths; hitting the server with a probe/health-check path it doesn't know.","solutions":["Check the exact endpoint names in handle_command's match arms and correct the request path","Verify client and server are from the same version of the codebase","Note the error response body's context for the path and adjust the caller"],"exampleFix":"// before\nGET /sim/fast-forward\n// after\nGET /sim/ffwd","handlingStrategy":"validation","validationCode":"// check the path against known endpoints before calling\nconst KNOWN = ['/sim/reset', '/sim/ffwd', '/geo/roads', ...];\nif (!KNOWN.includes(path)) console.warn('unknown endpoint', path);","typeGuard":null,"tryCatchPattern":"let resp = client.get(path).await?;\nif resp.text().await?.contains(\"Unknown command\") {\n    // wrong endpoint; refresh client API against server version\n}","preventionTips":["Generate the client from the server's match arms or keep them adjacent in code","Pin client and server to the same build/version","Watch for trailing-slash and case differences in paths"],"tags":["http","api","routing","unknown-endpoint"],"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"}