quickwit-oss/quickwit · error · anyhow::Error

created function has no version number

Error message

created function has no version number

What it means

After creating and publishing a new Lambda function version, `try_create_function` reads the version number from the AWS response. If `CreateFunctionOutput.version()` is None — i.e. AWS did not return a published version despite the call succeeding — the code treats it as an anomaly and fails, since deploying without a concrete version ARN is meaningless. This guards against an unexpected AWS response shape.

Source

Thrown at quickwit/quickwit-lambda-client/src/deploy.rs:333

        .runtime(Runtime::Providedal2023)
        .role(&deploy_config.execution_role_arn)
        .handler("bootstrap")
        .description(description)
        .code(function_code)
        .architectures(Architecture::Arm64)
        .memory_size(memory_size_mb)
        .timeout(timeout_secs)
        .environment(build_environment())
        .set_tags(Some(build_tags()))
        .publish(true)
        .send()
        .await;

    match create_result {
        Ok(output) => {
            let version = output
                .version()
                .ok_or_else(|| anyhow!("created function has no version number"))?
                .to_string();
            info!(
                function_name = %function_name,
                version = %version,
                "lambda function created and published"
            );
            Ok(Some(version))
        }
        Err(SdkError::ServiceError(err)) if err.err().is_resource_conflict_exception() => {
            debug!(
                function_name = %function_name,
                "lambda function already exists"
            );
            Ok(None)
        }
        Err(e) => Err(anyhow!(
            "failed to create Lambda function '{}': {}",
            function_name,

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Verify the create call publishes a version (check that the deploy code requests publication) and inspect the raw AWS response.
  2. Check for an AWS SDK for Rust update that changed `version()` semantics; pin or update the SDK accordingly.
  3. Retry the operation — if it persists, create the function without publish and then call `publish_version` explicitly to obtain a version.
  4. Log the full `CreateFunctionOutput` to confirm whether AWS returned a version.

Example fix

// before
let version = output.version().ok_or_else(|| anyhow!("created function has no version number"))?.to_string();
// after: publish explicitly if version missing
let version = match output.version() {
    Some(v) => v.to_string(),
    None => {
        let published = client.publish_version().function_name(function_name).send().await?;
        published.version().ok_or_else(|| anyhow!("published version missing"))?.to_string()
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

// after create, check the response carries a version before using it
if create_output.version().is_none() {
    warn!("CreateFunction returned no version; falling back to publish_version");
}

Type guard

fn has_version(out: &CreateFunctionOutput) -> Option<String> {
    out.version().map(|v| v.to_string())
}

Try / catch

match deploy_lambda_function(...).await {
    Err(e) if e.to_string().contains("created function has no version number") => {
        warn!("missing version in CreateFunction response; publishing explicitly");
        let published = lambda.publish_version().function_name(name).send().await?;
        use_published_version(published)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: `create_function` succeeds but the output has no version field — e.g. the function was created without `Publish=true` semantics being honored, an SDK/response incompatibility after an AWS API or SDK version change, or an anomalous empty response from the service.

Common situations: AWS SDK version upgrade changing how `version()` behaves; Lambda API returning a partial response; deploy automation running against a mocked/legacy endpoint that omits the version field.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/1556c55f2ff1d937. Report an issue: GitHub.