{"record":{"id":"cff32c7525851836","repo":"astrid-runtime/astrid","slug":"daemon-request-e","errorCode":null,"errorMessage":"daemon request: {e}","messagePattern":"daemon request: (.+?)","errorType":"http","errorClass":"GatewayError::Internal","httpStatus":500,"severity":"error","filePath":"crates/astrid-gateway/src/routes/auth.rs","lineNumber":137,"sourceCode":"                    .max(1),\n            });\n        }\n    }\n\n    // `InviteRedeem` doesn't need a verified caller principal — the\n    // token is the auth and the kernel's admin dispatcher bypasses\n    // the cap-gate for this variant. Stamp the IPC message with the\n    // `default` principal so the kernel's `resolve_caller` has *a*\n    // value to log; the handler ignores it.\n    let client = state.admin_client(PrincipalId::default())?;\n    let resp = client\n        .request(AdminRequestKind::InviteRedeem {\n            token: body.token,\n            public_key: body.public_key,\n            display_name: body.display_name,\n        })\n        .await\n        .map_err(|e| GatewayError::Internal(anyhow::anyhow!(\"daemon request: {e}\")))?;\n    let redeemed = match resp {\n        AdminResponseBody::InviteRedeemed(r) => r,\n        AdminResponseBody::Error(msg) => return Err(GatewayError::Kernel(msg)),\n        other => {\n            return Err(GatewayError::Internal(anyhow::anyhow!(\n                \"unexpected response shape: {other:?}\"\n            )));\n        },\n    };\n\n    let session_token = mint_bearer(\n        &state.signing.signer,\n        &redeemed.principal,\n        state.config.session_lifetime_secs,\n    );\n    let session_expires_at_epoch = std::time::SystemTime::now()\n        .duration_since(std::time::UNIX_EPOCH)\n        .map_or(0, |d| d.as_secs())","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-gateway/src/routes/auth.rs#L119-L155","documentation":"post_redeem (invite redemption) maps any failure of the admin/daemon client request into an Internal (500) error \"daemon request: {e}\". It means the gateway could not get a successful response from the kernel/daemon for the InviteRedeem admin request — transport, connection, or client-level failure.","triggerScenarios":"POST /api/auth/redeem where client.request(AdminRequestKind::InviteRedeem{...}).await returns Err — daemon unreachable, connection refused, request timeout, or serialization failure.","commonSituations":"Kernel daemon not running or crashed; wrong daemon socket/URL configured; network partition between gateway and daemon; daemon overloaded and timing out.","solutions":["Check the daemon is running and reachable (socket/address in gateway config).","Look at the wrapped {e} message for the exact transport failure (connection refused vs timeout).","Redeploy/restart the kernel daemon if it crashed, then retry redemption.","Verify gateway-to-daemon configuration matches the daemon's actual listen address."],"exampleFix":"// before: config pointing at a dead socket\nadmin_addr = \"/run/astrid/daemon.sock\"\n// after: ensure daemon is up and address correct\n$ systemctl status astrid-daemon  # then restart gateway","handlingStrategy":"retry","validationCode":"// precheck daemon reachability before redemption\nconst ok = await fetch('/api/health'); // gateway health implies daemon link\nif (!ok.ok) throw new Error('daemon unreachable; retry later');","typeGuard":null,"tryCatchPattern":"match client.request(AdminRequestKind::InviteRedeem { .. }).await {\n    Ok(resp) => resp,\n    Err(e) if e.is_connect() || e.is_timeout() => backoff_retry(|| client.request(req.clone())).await\n        .map_err(|e| GatewayError::Internal(anyhow!(\"daemon request: {e}\")))?,\n    Err(e) => return Err(GatewayError::Internal(anyhow!(\"daemon request: {e}\"))),\n}","preventionTips":["Monitor daemon liveness and alert on restarts.","Use systemd/socket supervision so the daemon auto-recovers.","Set sane request timeouts and retry idempotent admin requests.","Validate daemon address config during deployment health checks."],"tags":["rust","network","daemon","invite"],"backgroundTag":"api-request-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}