{"record":{"id":"0efcc4eb8f81fb1d","repo":"astrid-runtime/astrid","slug":"provider-name-returned-a-result-for-a-different","errorCode":null,"errorMessage":"{provider_name} returned a result for a different operation","messagePattern":"(.+?) returned a result for a different operation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/storage.rs","lineNumber":256,"sourceCode":"    }\n    let operation_matches = matches!(\n        (&request.operation, &response.outcome),\n        (\n            StorageProviderOperationV1::Mount { .. },\n            StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Mounted { .. })\n        ) | (\n            StorageProviderOperationV1::Sync { .. },\n            StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Synced { .. })\n        ) | (\n            StorageProviderOperationV1::Status { .. },\n            StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Status { .. })\n        ) | (\n            StorageProviderOperationV1::Unmount { .. },\n            StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Unmounted { .. })\n        ) | (_, StorageProviderOutcomeV1::Failure(_))\n    );\n    if !operation_matches {\n        bail!(\"{provider_name} returned a result for a different operation\");\n    }\n    match &response.outcome {\n        StorageProviderOutcomeV1::Success(\n            StorageProviderSuccessV1::Mounted { mountpoint, .. }\n            | StorageProviderSuccessV1::Status { mountpoint, .. },\n        ) => validate_response_mountpoint(provider_name, mountpoint),\n        _ => Ok(()),\n    }\n}\n\nfn validate_response_mountpoint(provider_name: &str, mountpoint: &Path) -> Result<()> {\n    if !mountpoint.is_absolute()\n        || mountpoint.components().any(|component| {\n            matches!(\n                component,\n                std::path::Component::ParentDir | std::path::Component::CurDir\n            )\n        })","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/storage.rs#L238-L274","documentation":"validate_response verifies with a matches! guard that the response outcome corresponds to the request operation: a Mount request must yield a Mounted/Success outcome (or any Failure), Unmount must yield Unmounted, etc. If the outcome variant does not match the operation, the response is for a different operation and the CLI bails.","triggerScenarios":"Sending a Mount request but receiving StorageProviderSuccessV1::Unmounted (or vice versa), or an unexpected Success variant for the operation — caught by the operation_matches check in validate_response.","commonSituations":"Provider implementation maps operations to the wrong outcome variant; response/request streams crossed between concurrent provider calls; a provider written against an older protocol version returns a legacy outcome shape the matcher doesn't recognize.","solutions":["Fix the provider to return the outcome variant matching the request operation","Ensure strict request/response correlation (single in-flight request per provider process)","Rebuild the provider against the current V1 protocol definitions","Add a provider-side exhaustive match over StorageProviderOperationV1 returning the correct Success variant"],"exampleFix":"// before (provider)\nlet outcome = StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Unmounted { .. }); // for Mount\n// after\nlet outcome = StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Mounted { mountpoint, .. });","handlingStrategy":"validation","validationCode":"fn outcome_matches(op: &StorageProviderOperationV1, out: &StorageProviderOutcomeV1) -> bool { matches!((op, out), (StorageProviderOperationV1::Mount{..}, StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Mounted{..})) | (StorageProviderOperationV1::Unmount{..}, StorageProviderOutcomeV1::Success(StorageProviderSuccessV1::Unmounted{..})) | (_, StorageProviderOutcomeV1::Failure(_))) }","typeGuard":"fn is_success_for(op: &StorageProviderOperationV1, out: &StorageProviderOutcomeV1) -> bool { !matches!(out, StorageProviderOutcomeV1::Failure(_)) && outcome_matches(op, out) }","tryCatchPattern":"let resp = run_provider(req)?;\nanyhow::ensure!(outcome_matches(&req.operation, &resp.outcome), \"provider outcome/operation mismatch\");","preventionTips":["Use one exhaustive match from operation to success variant in the provider","Keep one in-flight request per provider process","Regenerate provider code from the current V1 protocol definitions"],"tags":["ipc","protocol-mismatch","native-provider"],"backgroundTag":"unexpected-response-shape","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"}