nikivdev/code · error

Cloudflare API token required. Store it as personal env key

Error message

Cloudflare API token required. Store it as personal env key {}.

What it means

Error "Cloudflare API token required. Store it as personal env key {}." thrown in nikivdev/code.

Source

Thrown at src/deploy.rs:2766

        if !store_local && !store_cloud {
            bail!("Store token in cloud or local.");
        }

        let input = prompt_secret("Enter Cloudflare API token (input hidden): ")?;
        if input.trim().is_empty() {
            bail!("Cloudflare token required to deploy.");
        }
        if store_local {
            with_local_env_backend(|| crate::env::set_personal_env_var(&key, input.trim()))?;
        } else {
            crate::env::set_personal_env_var(&key, input.trim())?;
        }
        token = Some(input);
        println!("Saved {} to env store.", key);
    }

    let Some(token) = token else {
        bail!(
            "Cloudflare API token required. Store it as personal env key {}.",
            key
        );
    };

    unsafe {
        std::env::set_var("CLOUDFLARE_API_TOKEN", token.trim());
    }

    Ok(())
}

fn wants_local_env_backend() -> bool {
    if let Some(backend) = crate::config::preferred_env_backend() {
        return backend == "local";
    }
    if let Ok(value) = std::env::var("FLOW_ENV_BACKEND") {
        return value.trim().eq_ignore_ascii_case("local");

View on GitHub (pinned to a747e741ae)

When it happens

Trigger: Thrown at src/deploy.rs:2766 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/a72e6b5efb09a565. Report an issue: GitHub.