{"record":{"id":"52e8143498cc55bc","repo":"astrid-runtime/astrid","slug":"provider-name-protocol-mismatch-expected-re","errorCode":null,"errorMessage":"{provider_name} protocol mismatch: expected {}, received {}","messagePattern":"(.+?) protocol mismatch: expected (.+?), received (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/storage.rs","lineNumber":216,"sourceCode":"            vec![StorageProviderCapabilityV1::Lifecycle],\n        ),\n        StorageCommand::Unmount(args) => (\n            StorageProviderOperationV1::Unmount {\n                selector: StorageMountSelectorV1::NativePath(args.mountpoint),\n            },\n            vec![StorageProviderCapabilityV1::Lifecycle],\n        ),\n    })\n}\n\nfn validate_response(\n    provider_name: &str,\n    request: &StorageProviderRequestV1,\n    response: &StorageProviderResponseV1,\n    required_capabilities: &[StorageProviderCapabilityV1],\n) -> Result<()> {\n    if response.protocol_version != STORAGE_PROVIDER_PROTOCOL_V1 {\n        bail!(\n            \"{provider_name} protocol mismatch: expected {}, received {}\",\n            STORAGE_PROVIDER_PROTOCOL_V1,\n            response.protocol_version\n        );\n    }\n    if response.request_id != request.request_id {\n        bail!(\"{provider_name} returned a response for a different request\");\n    }\n    if response.provider.name != provider_name\n        || response.provider.version.is_empty()\n        || response.provider.version.len() > 128\n        || response.provider.version.chars().any(char::is_control)\n        || response.provider.capabilities.len() > 16\n        || !capabilities_are_unique(&response.provider.capabilities)\n    {\n        bail!(\"native provider identity does not match the co-installed executable\");\n    }\n    for capability in required_capabilities {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/storage.rs#L198-L234","documentation":"validate_response checks that the provider's reply carries STORAGE_PROVIDER_PROTOCOL_V1 before inspecting anything else. A mismatch means the installed provider binary speaks a different protocol version than the CLI expects, so the response is rejected to prevent misinterpreting fields. This guards the CLI/provider contract across upgrades.","triggerScenarios":"Running a native storage provider built against a different protocol version (older provider after CLI upgrade, or newer provider with an older CLI); a provider that hardcodes the wrong version constant in StorageProviderResponseV1.","commonSituations":"Partially upgraded deployments where the CLI and the provider plugin come from different releases; hand-rolled providers that forgot to bump/set protocol_version; mixing distro-packaged providers with a cargo-installed CLI.","solutions":["Upgrade or downgrade the provider binary so its protocol version matches the CLI's STORAGE_PROVIDER_PROTOCOL_V1.","Reinstall CLI and providers together from the same release so versions stay in lockstep.","If you own the provider, set protocol_version = STORAGE_PROVIDER_PROTOCOL_V1 in the response and re-release."],"exampleFix":"// before (provider)\nStorageProviderResponseV1 { protocol_version: 2, .. }\n\n// after (provider)\nStorageProviderResponseV1 { protocol_version: STORAGE_PROVIDER_PROTOCOL_V1, .. }\n# or: upgrade the astrid-cli/provider pair to matching versions","handlingStrategy":"validation","validationCode":"let v = provider_protocol_version(provider_path)?; // ask provider its version up front\nif v != STORAGE_PROVIDER_PROTOCOL_V1 {\n    eprintln!(\"provider protocol {v} != required {STORAGE_PROVIDER_PROTOCOL_V1}; upgrade it\");\n}","typeGuard":null,"tryCatchPattern":"match run_storage_command(args).await {\n    Err(e) if e.to_string().contains(\"protocol mismatch\") => {\n        eprintln!(\"Reinstall the provider from the same release as the CLI.\");\n    }\n    other => other?,\n}","preventionTips":["Always upgrade the CLI and its native providers together from one release.","Providers must set protocol_version from the shared STORAGE_PROVIDER_PROTOCOL_V1 constant.","Add a pre-flight version handshake when integrating custom providers."],"tags":["storage","provider-protocol","version-mismatch","protocol"],"backgroundTag":"incompatible-source-type","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}