{"record":{"id":"9f45cb7da83ac921","repo":"astrid-runtime/astrid","slug":"unsupported-mcp-attach-registration-version","errorCode":null,"errorMessage":"unsupported MCP attach registration version {}","messagePattern":"unsupported MCP attach registration version (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/mcp/gateway.rs","lineNumber":921,"sourceCode":"        GatewayRequest::Control(control) => {\n            if control.version != GATEWAY_CONTROL_VERSION {\n                anyhow::bail!(\n                    \"unsupported MCP gateway control version {}\",\n                    control.version\n                );\n            }\n            if control.pid == 0 || control.hook_token.trim().is_empty() {\n                anyhow::bail!(\"MCP gateway control authority is incomplete\");\n            }\n        },\n        GatewayRequest::Attach(registration) => validate_registration(registration)?,\n    }\n    Ok(request)\n}\n\nfn validate_registration(registration: &AttachRegistration) -> Result<()> {\n    if registration.version != ATTACH_REGISTRATION_VERSION {\n        anyhow::bail!(\n            \"unsupported MCP attach registration version {}\",\n            registration.version\n        );\n    }\n    super::lifecycle::resolve_principal(Some(&registration.principal))?;\n    if registration.host.trim().is_empty() {\n        anyhow::bail!(\"MCP attach registration has an empty host\");\n    }\n    if registration.host_session_id.trim().is_empty() {\n        anyhow::bail!(\"MCP attach registration has an empty host_session_id\");\n    }\n    if registration.hook_token.trim().is_empty() {\n        anyhow::bail!(\"MCP attach registration is missing hook_token\");\n    }\n    validate_workspace(&registration.workspace_abs)?;\n    Ok(())\n}\n","sourceCodeStart":903,"sourceCodeEnd":939,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/mcp/gateway.rs#L903-L939","documentation":"validate_registration checks that an incoming GatewayRequest::Attach registration's version equals ATTACH_REGISTRATION_VERSION before resolving the principal or examining any other fields. A mismatched version is rejected immediately so older/newer clients cannot attach with an incompatible registration schema.","triggerScenarios":"An attach client sends a registration whose registration.version differs from the gateway's ATTACH_REGISTRATION_VERSION constant; called from read_gateway_request_inner during preface parsing.","commonSituations":"Version skew after upgrading the CLI on one side only (editor extension old, CLI new, or vice versa); a custom attach client hardcoding a stale version; replaying a recorded/cached registration payload from an older protocol revision.","solutions":["Align versions: upgrade or reinstall astrid on both the attaching client and the daemon/gateway host so ATTACH_REGISTRATION_VERSION matches.","Update custom integrations to serialize registration.version from the current constant instead of a literal.","Restart the gateway daemon after upgrades so it is not running stale code from a previous socket lease.","Clear stale gateway ready/lease/socket files under daemon_root before reconnecting post-upgrade."],"exampleFix":"// before\nAttachRegistration { version: 1, host, host_session_id, principal, hook_token }\n// after\nAttachRegistration { version: ATTACH_REGISTRATION_VERSION, host, host_session_id, principal, hook_token }","handlingStrategy":"validation","validationCode":"fn registration_version_ok(v: u32, expected: u32) -> bool { v == expected }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"unsupported MCP attach registration version\") => eprintln!(\"upgrade client and gateway to the same version\"),\n    other => other?,\n}","preventionTips":["Serialize registration.version from ATTACH_REGISTRATION_VERSION, never a literal.","Upgrade client and daemon together.","Restart the gateway after version upgrades.","Pin compatible versions in editor-extension / CLI integrations."],"tags":["mcp","versioning","gateway","compatibility"],"backgroundTag":"unsupported-enum-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}