{"record":{"id":"b8f0cd1baa8023f1","repo":"google-gemini/gemini-cli","slug":"access-to-the-default-cloud-shell-gemini-project-w","errorCode":null,"errorMessage":"Access to the default Cloud Shell Gemini project was denied.\nPlease set your own Google Cloud project by running:\ngcloud config set project [PROJECT_ID]\nor setting export GOOGLE_CLOUD_PROJECT=...","messagePattern":"Access to the default Cloud Shell Gemini project was denied\\.\nPlease set your own Google Cloud project by running:\ngcloud config set project \\[PROJECT_ID\\]\nor setting export GOOGLE_CLOUD_PROJECT=\\.\\.\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/code_assist/server.ts","lineNumber":284,"sourceCode":"\n  async loadCodeAssist(\n    req: LoadCodeAssistRequest,\n  ): Promise<LoadCodeAssistResponse> {\n    try {\n      return await this.requestPost<LoadCodeAssistResponse>(\n        'loadCodeAssist',\n        req,\n      );\n    } catch (e) {\n      if (isVpcScAffectedUser(e)) {\n        return {\n          currentTier: { id: UserTierId.STANDARD },\n        };\n      } else if (\n        isPermissionDeniedError(e) &&\n        req.cloudaicompanionProject === 'cloudshell-gca'\n      ) {\n        throw new Error(\n          'Access to the default Cloud Shell Gemini project was denied.\\n' +\n            'Please set your own Google Cloud project by running:\\n' +\n            'gcloud config set project [PROJECT_ID]\\n' +\n            'or setting export GOOGLE_CLOUD_PROJECT=...',\n        );\n      } else {\n        throw e;\n      }\n    }\n  }\n\n  async refreshAvailableCredits(): Promise<void> {\n    if (!this.paidTier) {\n      return;\n    }\n    const res = await this.loadCodeAssist({\n      cloudaicompanionProject: this.projectId,\n      metadata: {","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/core/src/code_assist/server.ts#L266-L302","documentation":"Thrown by CodeAssistServer.loadCodeAssist() when the API returns a permission-denied error specifically for the default Cloud Shell project 'cloudshell-gca'. Google Cloud Shell provisions a shared default project for Gemini Code Assist; if the user's account lacks access to it (e.g., org policy restrictions, project disabled, or the user should use their own project), this error directs them to set a personal project via gcloud or the GOOGLE_CLOUD_PROJECT env var.","triggerScenarios":"loadCodeAssist() is called with req.cloudaicompanionProject === 'cloudshell-gca' and the API responds with a PERMISSION_DENIED error. The catch block checks isPermissionDeniedError(e) and the project name; if both match, this error is thrown with remediation instructions.","commonSituations":"Google Cloud Shell users whose organization restricts access to the shared 'cloudshell-gca' project; the default project was quota-capped or disabled; org policies prevent cross-project access; user is in a VPC-SC perimeter that blocks the shared project (though that case is handled separately by isVpcScAffectedUser).","solutions":["Set your own project: run 'gcloud config set project YOUR_PROJECT_ID'.","Alternatively, set export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID in your shell.","Ensure your Google account has the Gemini Code Assist API enabled on your chosen project.","If in Cloud Shell, verify your project has the necessary APIs enabled via the Cloud Console."],"exampleFix":"# Set your own project before running the CLI\ngcloud config set project my-project-123\nexport GOOGLE_CLOUD_PROJECT=my-project-123\n\n# Or set the env var directly\nexport GOOGLE_CLOUD_PROJECT=my-project-123\ngemini","handlingStrategy":"validation","validationCode":"// Ensure a non-default project is set before using Code Assist in Cloud Shell\nfunction resolveProjectId(): string | undefined {\n  return (\n    process.env['GOOGLE_CLOUD_PROJECT'] ||\n    process.env['GOOGLE_CLOUD_PROJECT_ID'] ||\n    undefined\n  );\n}\n\nconst projectId = resolveProjectId();\nif (!projectId || projectId === 'cloudshell-gca') {\n  throw new Error('Set GOOGLE_CLOUD_PROJECT to your own project ID.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await server.loadCodeAssist(req);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('cloudshell-gca')) {\n    console.error('Cloud Shell default project denied. Run: gcloud config set project YOUR_PROJECT_ID');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Always set GOOGLE_CLOUD_PROJECT to a personal project in Cloud Shell.","Run 'gcloud config set project PROJECT_ID' in shell init scripts.","Ensure the project has the Gemini Code Assist API enabled.","Avoid relying on the shared 'cloudshell-gca' default project."],"tags":["code-assist","permissions","cloud-shell","project-id","gcp"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}