{"record":{"id":"6e7eef2296a32ecd","repo":"google-gemini/gemini-cli","slug":"empty-command-in-auth-value-expected-format-com","errorCode":null,"errorMessage":"Empty command in auth value. Expected format: !command","messagePattern":"Empty command in auth value\\. Expected format: !command","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/auth-provider/value-resolver.ts","lineNumber":51,"sourceCode":"  // Environment variable: $MY_VAR\n  if (value.startsWith('$')) {\n    const envVar = value.slice(1);\n    const resolved = process.env[envVar];\n    if (resolved === undefined || resolved === '') {\n      throw new Error(\n        `Environment variable '${envVar}' is not set or is empty. ` +\n          `Please set it before using this agent.`,\n      );\n    }\n    debugLogger.debug(`[AuthValueResolver] Resolved env var: ${envVar}`);\n    return resolved;\n  }\n\n  // Shell command: !command arg1 arg2\n  if (value.startsWith('!')) {\n    const command = value.slice(1).trim();\n    if (!command) {\n      throw new Error('Empty command in auth value. Expected format: !command');\n    }\n\n    debugLogger.debug(`[AuthValueResolver] Executing command for auth value`);\n\n    const shellConfig = getShellConfiguration();\n    try {\n      const { stdout } = await spawnAsync(\n        shellConfig.executable,\n        [...shellConfig.argsPrefix, command],\n        {\n          signal: AbortSignal.timeout(COMMAND_TIMEOUT_MS),\n          windowsHide: true,\n        },\n      );\n\n      const trimmed = stdout.trim();\n      if (!trimmed) {\n        throw new Error(`Command '${command}' returned empty output`);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/core/src/agents/auth-provider/value-resolver.ts#L33-L69","documentation":"Thrown by resolveAuthValue when a value starts with '!' (the shell-command sigil) but slicing off the '!' and trimming yields an empty string. This is a pure config-validation guard: there is no command to run.","triggerScenarios":"resolveAuthValue('!') or resolveAuthValue('!   ') (bang followed by only whitespace). Any agent auth field whose value is literally '!' or whitespace after the bang.","commonSituations":"Config typo such as token: '!' left as a placeholder; YAML/JSON mis-indentation producing an empty command; copy-paste of a template where the command body was never filled in; trailing whitespace only.","solutions":["Provide a real command after the bang, e.g. '!op read op://vault/item/credential'.","If the value should be literal text starting with !, escape it as !!VALUE.","Remove the field entirely if no command-based credential is intended."],"exampleFix":"// before\nauth: { type: 'apiKey', apiKey: '!' }\n\n// after\nauth: { type: 'apiKey', apiKey: '!op read op://vault/item/credential' }","handlingStrategy":"validation","validationCode":"function validateAuthCommand(value) {\n  if (value.startsWith('!') && !value.startsWith('!!')) {\n    if (value.slice(1).trim() === '')\n      throw new Error('Auth command is empty after \"!\"');\n  }\n}","typeGuard":"function isEmptyAuthCommand(v: string): boolean {\n  return v.startsWith('!') && !v.startsWith('!!') && v.slice(1).trim() === '';\n}","tryCatchPattern":null,"preventionTips":["Treat '!' in auth config as a command sigil and always follow it with a real command.","Use !! to escape a literal !.","Lint agent config files for empty auth commands."],"tags":["auth","config","validation"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}