{"record":{"id":"6c97ee684af45145","repo":"seanmonstar/warp","slug":"missing-scheme","errorCode":null,"errorMessage":"missing scheme","messagePattern":"missing scheme","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/filters/cors.rs","lineNumber":617,"sourceCode":"        fn seconds(self) -> u64 {\n            self.into()\n        }\n    }\n\n    impl Seconds for ::std::time::Duration {\n        fn seconds(self) -> u64 {\n            self.as_secs()\n        }\n    }\n\n    pub trait IntoOrigin {\n        fn into_origin(self) -> Origin;\n    }\n\n    impl<'a> IntoOrigin for &'a str {\n        fn into_origin(self) -> Origin {\n            let mut parts = self.splitn(2, \"://\");\n            let scheme = parts.next().expect(\"missing scheme\");\n            let rest = parts.next().expect(\"missing scheme\");\n\n            Origin::try_from_parts(scheme, rest, None).expect(\"invalid Origin\")\n        }\n    }\n}\n","sourceCodeStart":599,"sourceCodeEnd":624,"githubUrl":"https://github.com/seanmonstar/warp/blob/ff34d7213ed55ec342304aa7ff6ac4b351da9e66/src/filters/cors.rs#L599-L624","documentation":"IntoOrigin for &str splits the input on '://' and expects both a scheme and a remainder, panicking with 'missing scheme' otherwise. So cors().allow_origins(&[\"example.com\"]) (no scheme) panics during filter construction.","triggerScenarios":"Calling allow_origins/allow_origin with an origin string lacking '://', e.g. \"example.com\", \"localhost:8080\" — splitn yields only one part and the second expect fires.","commonSituations":"Writing hosts from config without the https:// prefix; assuming bare hostnames are acceptable origins; migrating configs from other CORS libraries that accept bare hosts.","solutions":["Always include the scheme: \"https://example.com\" instead of \"example.com\"","Preprocess config origins to prepend \"https://\" when the scheme is absent (if that matches intent)","Validate origins at config load time and fail fast with a clear message"],"exampleFix":"// before\nwarp::cors().allow_origin(\"example.com\")\n// after\nwarp::cors().allow_origin(\"https://example.com\")","handlingStrategy":"validation","validationCode":"fn has_scheme(origin: &str) -> bool { origin.contains(\"://\") }\nfor o in origins { assert!(has_scheme(o), \"origin '{}' missing scheme\", o); }","typeGuard":"fn as_origin(s: &str) -> Option<String> { s.contains(\"://\").then(|| s.to_string()) }","tryCatchPattern":null,"preventionTips":["Always write origins as scheme://host (https://example.com)","Normalize bare hostnames from config by prepending a scheme when intentional","Fail fast at config load with a clear message for scheme-less origins"],"tags":["cors","origin","panic","url"],"backgroundTag":"invalid-url-format","analyzedSha":"ff34d7213ed55ec342304aa7ff6ac4b351da9e66","analyzedAt":"2026-09-09T16:57:46.316Z","contentChangedAt":"2026-09-09T16:57:46.316Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}