wasmerio/wasmer · error · DeployError

app field empty

Error message

app field empty

What it means

wait_app in lib/sdk/src/app/deploy.rs extracts the app id from the AppVersion response returned by the deploy API. The GraphQL AppVersion type's `app` field is nullable; if the backend returns a version without an associated app, the code raises DeployError::Api("app field empty") instead of panicking. It indicates an unexpected/incomplete server response during deploy polling.

Source

Thrown at lib/sdk/src/app/deploy.rs:144

    .await?;

    progress(DeployProgress::Waiting(opts.wait));
    wait_app(client, &version, opts.wait, opts.make_default).await
}

async fn wait_app(
    client: &WasmerClient,
    version: &DeployAppVersion,
    wait: WaitMode,
    make_default: bool,
) -> Result<(DeployApp, DeployAppVersion), DeployError> {
    const PROBE_TIMEOUT: Duration = Duration::from_secs(60 * 5);
    use wasmer_config::app::HEADER_APP_VERSION_ID;

    let app_id = version
        .app
        .as_ref()
        .ok_or_else(|| DeployError::Api(anyhow::anyhow!("app field empty")))?
        .id
        .inner()
        .to_string();

    let app = wasmer_backend_api::query::get_app_by_id(client, app_id.clone())
        .await
        .map_err(DeployError::Api)?;

    match wait {
        WaitMode::Deployed => {}
        WaitMode::Reachable => {
            tokio::time::sleep(Duration::from_secs(2)).await;
            let check_url = if make_default { &app.url } else { &version.url };
            let http = reqwest::Client::builder()
                .connect_timeout(Duration::from_secs(10))
                .timeout(Duration::from_secs(90))
                .redirect(reqwest::redirect::Policy::none())
                .build()

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Retry the deploy — if transient backend inconsistency, a fresh deploy_app run usually succeeds.
  2. Verify you are authenticated against the correct registry/backend (`wasmer whoami`) and your token has access to the app.
  3. Check the app still exists on the backend (wasmer app list / web dashboard) before redeploying.
  4. Update the CLI/SDK — older clients may mis-handle newer API responses.
  5. If persistent, inspect the raw GraphQL response (enable debug logging) and report the backend issue.

Example fix

// before: assumes app is always present
wait_app(client, &version, domain).await?;
// after: fail fast with context if the API response is incomplete
anyhow::ensure!(version.app.is_some(), "API returned AppVersion {:?} without an app; cannot wait for deployment", version.id);
wait_app(client, &version, domain).await?;
Defensive patterns

Strategy: try-catch

Validate before calling

// guard before waiting on a version
fn version_has_app(v: &AppVersion) -> bool { v.app.is_some() }
anyhow::ensure!(version_has_app(&version), "AppVersion {:?} has no app field; aborting wait", version.id);

Type guard

fn has_app(v: &AppVersion) -> Option<&App> { v.app.as_ref() }

Try / catch

match deploy_app(...).await {
    Err(DeployError::Api(e)) if e.to_string().contains("app field empty") => {
        eprintln!("Backend returned an incomplete AppVersion; check the app exists and retry the deploy");
        std::process::exit(1);
    }
    Ok(v) => v,
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: deploy_app calls wait_app with an AppVersion whose `app` field is null — e.g. the version was deleted concurrently, the backend returned a partial object, or the API returned an inconsistent response for a freshly created version.

Common situations: Deploy against a backend/registry with a schema mismatch (older server omitting the app field); the app was deleted between version creation and the wait; auth scope issues causing the server to omit related entities; transient backend bugs.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/deac2982ca447103. Report an issue: GitHub.