{"record":{"id":"1714a58a604bf260","repo":"nikivdev/code","slug":"project-not-found-create-it-with-f-env-push-fir","errorCode":null,"errorMessage":"Project not found. Create it with `f env push` first.","messagePattern":"Project not found\\. Create it with `f env push` first\\.","errorType":"http","errorClass":"anyhow::Error","httpStatus":404,"severity":"error","filePath":"src/env.rs","lineNumber":3800,"sourceCode":"        .header(\"Authorization\", format!(\"Bearer {}\", token))\n        .send()\n        .context(\"failed to connect to cloud\")?;\n\n    if resp.status() == 401 {\n        if std::io::stdin().is_terminal()\n            && prompt_confirm(\"Cloud auth failed. Read local envs instead? (y/N): \")?\n        {\n            let vars = read_local_env_vars(target, environment)?;\n            return Ok(select_requested_env_keys(vars, keys));\n        }\n        bail!(\"Unauthorized. Check your token with `f env login`.\");\n    }\n\n    if resp.status() == 404 {\n        match target {\n            EnvTarget::Personal { .. } => bail!(\"Personal env vars not found.\"),\n            EnvTarget::Project { .. } => {\n                bail!(\"Project not found. Create it with `f env push` first.\")\n            }\n        }\n    }\n\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().unwrap_or_default();\n        let err = anyhow::anyhow!(\"API error {}: {}\", status, body);\n        if is_local_fallback_error(&err)\n            && std::io::stdin().is_terminal()\n            && prompt_confirm(\"Cloud unavailable. Read local envs instead? (y/N): \")?\n        {\n            let vars = read_local_env_vars(target, environment)?;\n            return Ok(select_requested_env_keys(vars, keys));\n        }\n        return Err(err);\n    }\n","sourceCodeStart":3782,"sourceCodeEnd":3818,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/env.rs#L3782-L3818","documentation":"Raised when the cloud API returns 404 while fetching env vars for an EnvTarget::Project target. It means the project (as resolved from the local project config) does not exist server-side. The message explicitly directs the user to create it by pushing env vars.","triggerScenarios":"Running a fetch against project-scope env vars where the project name/id in local config has never been registered via `f env push`, so the API responds 404.","commonSituations":"Cloning a repo and pulling envs before anyone pushed them; local project config pointing at a renamed or deleted project; working in a fresh project directory where `f env push` was never run.","solutions":["Run `f env push` in the project to create the project and its env vars, then retry the pull.","Check the project name/id in local config matches the project on the server.","If the project was renamed/deleted remotely, update local config to the correct project and re-authenticate if needed."],"exampleFix":"// before: fresh clone, project never registered\nf env pull\n// after\nf env push   # registers project + uploads vars\nf env pull","handlingStrategy":"fallback","validationCode":"# verify project registration first\nf env list || { echo 'project not registered; run f env push'; exit 1; }","typeGuard":null,"tryCatchPattern":"// auto-register on first 404\nif let Err(e) = fetch_project_vars(&project, env) {\n    if e.to_string().contains(\"Project not found\") {\n        run(\"f env push\")?;\n        return fetch_project_vars(&project, env);\n    }\n    return Err(e);\n}","preventionTips":["Document `f env push` as the onboarding step for fresh clones.","Keep project name in local config in sync with the server after renames.","Add a setup script (bootstrap) that pushes before any pull in CI."],"tags":["http-404","cli","project","not-found"],"backgroundTag":"remote-resource-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}