{"record":{"id":"464735e54bb642e6","repo":"google-gemini/gemini-cli","slug":"invalid-approval-mode-rawapprovalmode-valid-v","errorCode":null,"errorMessage":"Invalid approval mode: ${rawApprovalMode}. Valid values are: yolo, auto_edit, plan, default","messagePattern":"Invalid approval mode: (.+?)\\. Valid values are: yolo, auto_edit, plan, default","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/config.ts","lineNumber":727,"sourceCode":"        break;\n      case 'auto_edit':\n        approvalMode = ApprovalMode.AUTO_EDIT;\n        break;\n      case 'plan':\n        if (!(settings.general?.plan?.enabled ?? true)) {\n          debugLogger.warn(\n            'Approval mode \"plan\" is disabled in your settings. Falling back to \"default\".',\n          );\n          approvalMode = ApprovalMode.DEFAULT;\n        } else {\n          approvalMode = ApprovalMode.PLAN;\n        }\n        break;\n      case 'default':\n        approvalMode = ApprovalMode.DEFAULT;\n        break;\n      default:\n        throw new Error(\n          `Invalid approval mode: ${rawApprovalMode}. Valid values are: yolo, auto_edit, plan, default`,\n        );\n    }\n  } else {\n    approvalMode = ApprovalMode.DEFAULT;\n  }\n\n  // Override approval mode if disableYoloMode is set.\n  if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {\n    if (approvalMode === ApprovalMode.YOLO) {\n      if (settings.admin?.secureModeEnabled) {\n        debugLogger.error(\n          'YOLO mode is disabled by \"secureModeEnabled\" setting.',\n        );\n      } else {\n        debugLogger.error(\n          'YOLO mode is disabled by the \"disableYolo\" setting.',\n        );","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/config/config.ts#L709-L745","documentation":"Thrown from the `default` branch of the approval-mode switch when the resolved `rawApprovalMode` is not one of `yolo`, `auto_edit`, `plan`, or `default`. The value is resolved from `argv.approvalMode`, the `--yolo` flag, or `settings.general.defaultApprovalMode`. An unrecognized value means the user typed the flag wrong or wrote an invalid setting in `settings.json`.","triggerScenarios":"Setting `\"defaultApprovalMode\": \"auto\"` in settings.json (the correct value is `auto_edit`); running `gemini --approval-mode yolo2` or `--approval-mode yes`; misspelling the mode in a config file; an extension injecting an unknown mode.","commonSituations":"Typo in settings.json (e.g., `auto` instead of `auto_edit`); older docs or tutorials that reference a since-renamed mode; copy-pasting from a different tool's vocabulary (`yes`, `accept`, `always`).","solutions":["Use one of the four exact values: `yolo`, `auto_edit`, `plan`, `default`.","Open `~/.gemini/settings.json` (or workspace `.gemini/settings.json`) and fix `general.defaultApprovalMode` to a valid string.","If using `--yolo`, remove any conflicting `--approval-mode` flag."],"exampleFix":"// before (settings.json)\n{ \"general\": { \"defaultApprovalMode\": \"auto\" } }\n// after\n{ \"general\": { \"defaultApprovalMode\": \"auto_edit\" } }","handlingStrategy":"validation","validationCode":"const VALID = new Set(['yolo', 'auto_edit', 'plan', 'default']);\nfunction resolveApprovalMode(raw: string | undefined): string {\n  if (raw === undefined) return 'default';\n  if (!VALID.has(raw)) {\n    throw new Error(`Invalid approval mode: ${raw}. Valid: ${[...VALID].join(', ')}`);\n  }\n  return raw;\n}","typeGuard":"const APPROVAL_MODES = ['yolo', 'auto_edit', 'plan', 'default'] as const;\ntype ApprovalModeName = (typeof APPROVAL_MODES)[number];\nfunction isApprovalMode(v: unknown): v is ApprovalModeName {\n  return typeof v === 'string' && (APPROVAL_MODES as readonly string[]).includes(v);\n}","tryCatchPattern":null,"preventionTips":["Lint settings.json with a JSON schema to catch typos before launch.","Note `auto_edit` uses an underscore, not a dash or space.","Prefer setting the mode via `--approval-mode` so the shell surfaces typos immediately."],"tags":["cli","config","approval-mode","validation","settings"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}