{"record":{"id":"75f5819e702def41","repo":"nikivdev/code","slug":"you-don-t-own-this-project","errorCode":null,"errorMessage":"You don't own this project.","messagePattern":"You don't own this project\\.","errorType":"http","errorClass":"anyhow::Error","httpStatus":403,"severity":"error","filePath":"src/env.rs","lineNumber":3995,"sourceCode":"    let body = serde_json::json!({\n        \"projectName\": project,\n        \"name\": token_name,\n        \"permissions\": permissions,\n    });\n\n    let resp = client\n        .post(&url)\n        .header(\"Authorization\", format!(\"Bearer {}\", token))\n        .json(&body)\n        .send()\n        .context(\"failed to connect to cloud\")?;\n\n    if resp.status() == 401 {\n        bail!(\"Unauthorized. Check your token with `f env login`.\");\n    }\n\n    if resp.status() == 403 {\n        bail!(\"You don't own this project.\");\n    }\n\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().unwrap_or_default();\n        bail!(\"API error {}: {}\", status, body);\n    }\n\n    let data: CreateTokenResponse = resp.json().context(\"failed to parse response\")?;\n\n    println!();\n    println!(\"✓ Service token created!\");\n    println!();\n    println!(\"Token:       {}\", data.token);\n    println!(\"Project:     {}\", data.project_name);\n    println!(\"Name:        {}\", data.name);\n    println!(\"Permissions: {}\", data.permissions);\n    println!();","sourceCodeStart":3977,"sourceCodeEnd":4013,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/env.rs#L3977-L4013","documentation":"Raised by the service-token creation path when the cloud API responds 403 Forbidden. Authentication succeeded (the token is valid) but the authenticated user is not the owner of the target project, so they may not create service tokens for it. This is an authorization (permissions) error, not an authentication error.","triggerScenarios":"Running the create-token command in a directory/config whose resolved project belongs to another user or org, so the API returns 403.","commonSituations":"Contributing to someone else's repo and trying to mint tokens for their project; local config pointing at the wrong (foreign) project; ownership transferred to an org your account isn't an admin of.","solutions":["Ask the project owner (or an org admin) to create the service token, or to grant you owner access.","Verify local project config resolves to a project you actually own.","If ownership transferred, have the new owner re-share or re-register the project with your account."],"exampleFix":"// before: local config points at teammate's project\n// f.toml: project = \"teammates-api\"\nf env token create ci-token\n// after: point at your own project or ask the owner\n// f.toml: project = \"my-api\"","handlingStrategy":"validation","validationCode":"# confirm you own the resolved project before creating tokens\nf env list   # a 403 here also signals you lack access to this project\n# check project identity in local config before proceeding","typeGuard":null,"tryCatchPattern":"// surface ownership requirement clearly\nmatch create_token(name) {\n    Err(e) if e.to_string().contains(\"don't own this project\") => {\n        eprintln!(\"ask the project owner to create this token or grant you owner access\");\n        std::process::exit(3);\n    }\n    other => other?,\n}","preventionTips":["Only attempt token creation on projects you own; check ownership in the dashboard first.","Keep local project config pointing at your own project in forks.","Have org admins create shared CI tokens instead of individual contributors."],"tags":["auth","http-403","permissions","cli","project"],"backgroundTag":"insufficient-permissions","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}