Hmbown/CodeWhale · error

this mutation requires async execute (network I/O)

Error message

this mutation requires async execute (network I/O)

What it means

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.

Solutions

  1. Route InstallRemote/Update/UpdateByName requests through the async execute() function instead of execute_sync
  2. Split the command handler: run local mutations synchronously and await execute() for anything registry-backed
  3. In tests, use the async executor (or a runtime block_on) when constructing remote/update mutation requests

Example fix

// before
mutation::execute_sync(request, &ctx)?; // request = Update { .. }
// after
let result = mutation::execute(request, &ctx).await?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn requires_async(req: &SkillMutationRequest) -> bool {
    matches!(req,
        SkillMutationRequest::InstallRemote { .. }
        | SkillMutationRequest::Update { .. }
        | SkillMutationRequest::UpdateByName { .. })
}

Type guard

fn is_sync_safe(req: &SkillMutationRequest) -> bool {
    !matches!(req,
        SkillMutationRequest::InstallRemote { .. }
        | SkillMutationRequest::Update { .. }
        | SkillMutationRequest::UpdateByName { .. })
}

Try / catch

if requires_async(&request) {
    mutation::execute(request, &ctx).await?;
} else {
    mutation::execute_sync(request, &ctx)?;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/361aaaf4fc91f730. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/skills/mutation.rs:438

            remove_skill(resolved.id, expected_digest.or(Some(resolved.digest)), ctx)
        }
        SkillMutationRequest::Trust {
            skill_id,
            expected_digest,
        } => trust_skill(skill_id, expected_digest, ctx),
        SkillMutationRequest::TrustByName {
            name,
            scope,
            expected_digest,
        } => {
            let resolved = resolve_owned_skill_by_name(ctx, &name, scope)?;
            let digest = expected_digest.unwrap_or(resolved.digest);
            trust_skill(resolved.id, digest, ctx)
        }
        SkillMutationRequest::InstallRemote { .. }
        | SkillMutationRequest::Update { .. }
        | SkillMutationRequest::UpdateByName { .. } => {
            bail!("this mutation requires async execute (network I/O)")
        }
    }
}

#[derive(Debug)]
struct ResolvedOwnedSkill {
    id: AuditedSkillId,
    digest: String,
}

fn resolve_owned_skill_by_name(
    ctx: &MutationContext<'_>,
    name: &str,
    scope: Option<SkillTargetScope>,
) -> Result<ResolvedOwnedSkill> {
    // Match SkillRegistry::get — users may pass frontmatter/dir forms
    // (Hello_World) while audit stores the folded canonical key (hello-world).
    let canonical = normalize_skill_name_for_lookup(name);

View on GitHub (pinned to 73e0f67d83)