{"record":{"id":"32b64d49bc2762a3","repo":"nikivdev/code","slug":"no-cloudflare-or-storage-env-keys-configured-i","errorCode":null,"errorMessage":"No [cloudflare] or [storage] env keys configured in flow.toml","messagePattern":"No \\[cloudflare\\] or \\[storage\\] env keys configured in flow\\.toml","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"src/env.rs","lineNumber":3202,"sourceCode":"                println!(\"  (no variables)\");\n            } else {\n                for variable in &env_cfg.variables {\n                    match variable.default.as_deref() {\n                        Some(default) if !default.is_empty() => {\n                            println!(\"  {} = {}\", variable.key, format_default_hint(default));\n                        }\n                        Some(_) => println!(\"  {}  (default: empty)\", variable.key),\n                        None => println!(\"  {}\", variable.key),\n                    }\n                }\n            }\n            println!();\n        }\n\n        return Ok(());\n    }\n\n    anyhow::bail!(\"No [cloudflare] or [storage] env keys configured in flow.toml\");\n}\n\n/// List env vars for this project.\nfn list(environment: &str) -> Result<()> {\n    if local_env_enabled() {\n        let target = resolve_env_target()?;\n        let label = env_target_label(&target);\n        let vars = read_local_env_vars(&target, environment)?;\n\n        println!(\"Space: {}\", label);\n        println!(\"Environment: {}\", environment);\n        println!(\"Backend: local\");\n        println!(\"─────────────────────────────\");\n\n        if vars.is_empty() {\n            println!(\"No env vars set.\");\n            return Ok(());\n        }","sourceCodeStart":3184,"sourceCodeEnd":3220,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/env.rs#L3184-L3220","documentation":"Bail-out at the end of the env-key listing/export routine: after checking all configured sources, neither `[cloudflare]` env keys nor `[storage]` env keys were found in flow.toml, and no earlier code path printed results and returned. The library raises this so the user knows their flow.toml simply has no env keys configured for either subsystem.","triggerScenarios":"Running the env key listing command on a project whose flow.toml defines no env keys under `[cloudflare]` and none under `[storage]`; the function falls through past the early-return `Ok(())` and reaches the final `anyhow::bail!`.","commonSituations":"Brand-new project before any env keys were added; flow.toml trimmed of all env config; typo'd section names (e.g. `[cloudflair]`) so the parser sees none of the expected keys.","solutions":["Add env keys to the `[cloudflare]` section in flow.toml (e.g. `env = { MY_KEY = \"value\" }`)","Add env keys to the `[storage]` section in flow.toml","Check flow.toml section names for typos so the parser actually sees [cloudflare] or [storage]","If intentionally empty, treat empty output as normal rather than running the listing command"],"exampleFix":"// before (flow.toml)\n[project]\nname = \"my-app\"\n\n// after (flow.toml)\n[project]\nname = \"my-app\"\n\n[cloudflare.env]\nMY_API_KEY = \"xxx\"","handlingStrategy":"validation","validationCode":"let toml = std::fs::read_to_string(\"flow.toml\")?;\nif !toml.contains(\"[cloudflare]\") && !toml.contains(\"[storage]\") {\n    anyhow::bail!(\"flow.toml needs [cloudflare] or [storage] env keys\");\n}","typeGuard":"fn has_env_keys(cfg: &Config) -> bool {\n    cfg.cloudflare.as_ref().map_or(false, |c| !c.env.is_empty())\n        || cfg.storage.as_ref().map_or(false, |s| !s.env.is_empty())\n}","tryCatchPattern":"match list_env_keys() {\n    Err(e) if e.to_string().contains(\"No [cloudflare] or [storage]\") => {\n        eprintln!(\"No env keys configured yet — nothing to list.\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Seed new projects with at least one env key in [cloudflare.env]","Double-check section name spelling ([cloudflare], not [cloudflair])","Treat empty env output as expected for fresh projects instead of scripting around the error","Run config lint as part of onboarding"],"tags":["config","toml","env","cloudflare"],"backgroundTag":"missing-env-var","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}