{"record":{"id":"849b317fd6fb60c2","repo":"google-gemini/gemini-cli","slug":"logprefix-unable-to-set-generatorconfig-plea","errorCode":null,"errorMessage":"[${logPrefix}] Unable to set GeneratorConfig. Please provide a GEMINI_API_KEY or set USE_CCPA.","messagePattern":"\\[(.+?)\\] Unable to set GeneratorConfig\\. Please provide a GEMINI_API_KEY or set USE_CCPA\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/a2a-server/src/config/config.ts","lineNumber":655,"sourceCode":"          );\n        }\n        throw e;\n      }\n    }\n\n    logger.info(\n      `[${logPrefix}] GOOGLE_CLOUD_PROJECT: ${getEnvLocal('GOOGLE_CLOUD_PROJECT')}`,\n    );\n  } else if (getEnvLocal('GEMINI_API_KEY')) {\n    logger.info(`[${logPrefix}] Using Gemini API Key`);\n    await config.refreshAuth(\n      AuthType.USE_GEMINI,\n      getEnvLocal('GEMINI_API_KEY'),\n    );\n  } else {\n    const errorMessage = `[${logPrefix}] Unable to set GeneratorConfig. Please provide a GEMINI_API_KEY or set USE_CCPA.`;\n    logger.error(errorMessage);\n    throw new Error(errorMessage);\n  }\n}\n","sourceCodeStart":637,"sourceCodeEnd":658,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/a2a-server/src/config/config.ts#L637-L658","documentation":"Plain Error thrown by refreshAuthentication in the final else branch: neither USE_CCPA nor GEMINI_API_KEY is present in the resolved environment. The executor cannot pick any authentication strategy to build the GeneratorConfig, so it refuses to start. The same message is logged at error level before throwing.","triggerScenarios":"Server startup or task creation with no auth env vars after loadEnvironment merges workspace .env files - both USE_CCPA and GEMINI_API_KEY are absent/empty. Common in fresh deployments that forgot to provision credentials.","commonSituations":"Fresh clone without .env; CI without injected secrets; .env file under the workspace ignored because the workspace is untrusted (loadEnvironment bypasses workspace .env for untrusted workspaces and only reads home).","solutions":["Set GEMINI_API_KEY in the environment (or in ~/.gemini/.env for untrusted workspaces).","Or set USE_CCPA=true along with valid compute credentials.","If using a workspace .env, ensure the workspace is trusted so loadEnvironment reads it.","Confirm the env var isn't being shadowed by an empty value (export GEMINI_API_KEY= with no value still fails the getEnvLocal check)."],"exampleFix":"# before\n# no auth env vars set\n\n# after\nexport GEMINI_API_KEY=AIza...\n# or\nexport USE_CCPA=true\nexport GOOGLE_APPLICATION_CREDENTIALS=/secrets/sa.json","handlingStrategy":"validation","validationCode":"function hasAuthStrategy(env: NodeJS.ProcessEnv): boolean {\n  return env['USE_CCPA'] === 'true' || !!env['GEMINI_API_KEY'];\n}\nif (!hasAuthStrategy(process.env)) {\n  throw new Error('Missing auth: set GEMINI_API_KEY or USE_CCPA before starting the agent.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set GEMINI_API_KEY or USE_CCPA in the deployment env (or ~/.gemini/.env for untrusted workspaces).","Mark the workspace trusted if you need to load auth from a workspace-level .env.","Fail fast at startup with a clear message rather than letting the first task hit this.","Beware empty values: USE_CCPA='' is falsy and won't satisfy the check."],"tags":["authentication","config","env-vars","startup"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}