nikivdev/code · warning · anyhow::Error

Personal env vars not found.

Error message

Personal env vars not found.

What it means

Raised when the personal-env API returns HTTP 404, meaning no personal env vars exist for the authenticated user/project at the requested target. The library interprets a 404 as 'nothing configured yet' rather than a transport failure, so it bails with this concise message.

Source

Thrown at src/env.rs:3271

        EnvTarget::Personal { space } => {
            let mut url = Url::parse(&format!("{}/api/env/personal", api_url))?;
            url.query_pairs_mut()
                .append_pair("environment", environment);
            if let Some(space) = space {
                url.query_pairs_mut().append_pair("space", space);
            }
            let resp = client
                .get(url)
                .header("Authorization", format!("Bearer {}", token))
                .send()
                .context("failed to connect to cloud")?;

            if resp.status() == 401 {
                bail!("Unauthorized. Check your token with `f env login`.");
            }

            if resp.status() == 404 {
                bail!("Personal env vars not found.");
            }

            if !resp.status().is_success() {
                let status = resp.status();
                let body = resp.text().unwrap_or_default();
                bail!("API error {}: {}", status, body);
            }

            let data: PersonalEnvResponse = resp.json().context("failed to parse response")?;
            (data.env, None, "cloud")
        }
        EnvTarget::Project { name } => {
            let entries =
                fetch_project_cloud_env_entries(name, environment, &[], &api_url, token, &client)?;
            (entries.vars, Some(entries.descriptions), "cloud (sealed)")
        }
    };

View on GitHub (pinned to a747e741ae)

Solutions

  1. Set at least one personal env var first (e.g. via the set personal env var command) then re-run the read
  2. Verify the project/environment name in the request matches an existing one
  3. Check the cloud dashboard to confirm the env vars exist and for which scope
Defensive patterns

Strategy: fallback

Try / catch

match fetch_personal_envs() {
    Err(e) if e.to_string().contains("not found") => {
        eprintln!("No personal env vars yet; using empty set.");
        Ok(HashMap::new())
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: GET to the personal-env endpoint returns 404 — typically the first time a user queries personal env vars before ever setting one, or after the vars were deleted server-side; also a wrong project/slug in the request URL that doesn't correspond to an existing resource.

Common situations: Fresh account with no personal env vars set yet; env vars deleted by a teammate or via the web UI; querying an environment/scope name that doesn't exist.

Related errors


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