{"record":{"id":"fa8f8d59e3d8eb23","repo":"clockworklabs/SpacetimeDB","slug":"errno","errorCode":null,"errorMessage":"{errno}","messagePattern":"\\{errno\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bindings-sys/src/lib.rs","lineNumber":1655,"sourceCode":"    ) -> Result<(raw::BytesSource, raw::BytesSource), raw::BytesSource> {\n        let mut out = [raw::BytesSource::INVALID; 2];\n\n        let res = unsafe {\n            super::raw::procedure_http_request(\n                http_request_bsatn.as_ptr(),\n                http_request_bsatn.len() as u32,\n                body.as_ptr(),\n                body.len() as u32,\n                &mut out as *mut [raw::BytesSource; 2],\n            )\n        };\n\n        match super::Errno::from_code(res) {\n            // Success: `out` is a `spacetimedb_lib::http::Response`.\n            None => Ok((out[0], out[1])),\n            // HTTP_ERROR: `out` is a `spacetimedb_lib::http::Error`.\n            Some(errno) if errno == super::Errno::HTTP_ERROR => Err(out[0]),\n            Some(errno) => panic!(\"{errno}\"),\n        }\n    }\n}\n","sourceCodeStart":1637,"sourceCodeEnd":1659,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-sys/src/lib.rs#L1637-L1659","documentation":"Panic in the safe wrapper over the procedure_http_request syscall. Request-level failures (DNS, connect, timeout) are deliberately mapped by the host to HTTP_ERROR, which the wrapper returns as Err(BytesSource) - those do not panic. The panic fires only for the remaining errnos: WOULD_BLOCK_TRANSACTION (a transaction is currently open) and BSATN_DECODE_ERROR (the serialized spacetimedb_lib::http::Request was malformed).","triggerScenarios":"Issuing an outbound HTTP request from inside a reducer - reducers always hold an open transaction, so the host returns WOULD_BLOCK_TRANSACTION; or a Request whose BSATN encoding fails to decode because the module's spacetimedb lib version is out of sync with the host.","commonSituations":"Trying to validate input by calling an external API from a reducer; moving outbound calls into module HTTP handlers without checking which context they run in; crate/host version skew after an upgrade.","solutions":["Move outbound HTTP calls out of reducers - perform them from an HTTP-module handler context where no reducer transaction is open.","Handle the Err return path (HTTP_ERROR) for real request failures instead of assuming success.","Align the spacetimedb crate version with the host version and republish the module."],"exampleFix":"// before: outbound HTTP from a reducer (transaction open -> panic)\n#[spacetimedb::reducer]\nfn call_api(ctx: &ReducerContext) {\n    let _ = spacetimedb::http::client::request(req).unwrap(); // panics WOULD_BLOCK_TRANSACTION\n}\n\n// after: outbound HTTP in an http handler; reducers only enqueue work\n#[spacetimedb::http] \nfn trigger_api() { let _ = spacetimedb::http::client::request(req); }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"match spacetimedb::http::client::request(req) {\n    Ok(resp) => { /* http::Response */ }\n    Err(err_source) => { /* read http::Error from the BytesSource - real request failure */ }\n}","preventionTips":["Never issue outbound HTTP requests from reducers - a transaction is always open there.","Route external calls through module HTTP handlers and have reducers record work items instead.","Always handle the Err variant; HTTP-level failures are data, not panics."],"tags":["rust","http","transaction","wasm","host-call"],"backgroundTag":"http-request-failed","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}