{"record":{"id":"361aaaf4fc91f730","repo":"Hmbown/CodeWhale","slug":"this-mutation-requires-async-execute-network-i-o","errorCode":null,"errorMessage":"this mutation requires async execute (network I/O)","messagePattern":"this mutation requires async execute \\(network I/O\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":438,"sourceCode":"            remove_skill(resolved.id, expected_digest.or(Some(resolved.digest)), ctx)\n        }\n        SkillMutationRequest::Trust {\n            skill_id,\n            expected_digest,\n        } => trust_skill(skill_id, expected_digest, ctx),\n        SkillMutationRequest::TrustByName {\n            name,\n            scope,\n            expected_digest,\n        } => {\n            let resolved = resolve_owned_skill_by_name(ctx, &name, scope)?;\n            let digest = expected_digest.unwrap_or(resolved.digest);\n            trust_skill(resolved.id, digest, ctx)\n        }\n        SkillMutationRequest::InstallRemote { .. }\n        | SkillMutationRequest::Update { .. }\n        | SkillMutationRequest::UpdateByName { .. } => {\n            bail!(\"this mutation requires async execute (network I/O)\")\n        }\n    }\n}\n\n#[derive(Debug)]\nstruct ResolvedOwnedSkill {\n    id: AuditedSkillId,\n    digest: String,\n}\n\nfn resolve_owned_skill_by_name(\n    ctx: &MutationContext<'_>,\n    name: &str,\n    scope: Option<SkillTargetScope>,\n) -> Result<ResolvedOwnedSkill> {\n    // Match SkillRegistry::get — users may pass frontmatter/dir forms\n    // (Hello_World) while audit stores the folded canonical key (hello-world).\n    let canonical = normalize_skill_name_for_lookup(name);","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/skills/mutation.rs#L420-L456","documentation":"The synchronous mutation entry point execute_sync only supports local, no-network operations (import/remove/trust). InstallRemote, Update, and UpdateByName requests require network I/O, which the sync path forbids by design — these must go through the async execute path.","triggerScenarios":"Dispatching a SkillMutationRequest::InstallRemote, Update, or UpdateByName variant to execute_sync instead of execute; e.g. a blocking UI or test harness calling execute_sync with an install-from-registry request.","commonSituations":"Refactoring a command handler that used to be local-only to support registry installs without switching to the async executor; tests invoking the sync path with a constructed update request.","solutions":["Route InstallRemote/Update/UpdateByName requests through the async execute() function instead of execute_sync","Split the command handler: run local mutations synchronously and await execute() for anything registry-backed","In tests, use the async executor (or a runtime block_on) when constructing remote/update mutation requests"],"exampleFix":"// before\nmutation::execute_sync(request, &ctx)?; // request = Update { .. }\n// after\nlet result = mutation::execute(request, &ctx).await?;","handlingStrategy":"type-guard","validationCode":"fn requires_async(req: &SkillMutationRequest) -> bool {\n    matches!(req,\n        SkillMutationRequest::InstallRemote { .. }\n        | SkillMutationRequest::Update { .. }\n        | SkillMutationRequest::UpdateByName { .. })\n}","typeGuard":"fn is_sync_safe(req: &SkillMutationRequest) -> bool {\n    !matches!(req,\n        SkillMutationRequest::InstallRemote { .. }\n        | SkillMutationRequest::Update { .. }\n        | SkillMutationRequest::UpdateByName { .. })\n}","tryCatchPattern":"if requires_async(&request) {\n    mutation::execute(request, &ctx).await?;\n} else {\n    mutation::execute_sync(request, &ctx)?;\n}","preventionTips":["Route every registry-backed request (install/update) through the async executor","Add dispatch helpers so handlers never call execute_sync directly on remote variants","Keep tests that construct remote requests on an async runtime"],"tags":["skills","async","sync-api-misuse","network"],"backgroundTag":"unsupported-operation","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}