google-gemini/gemini-cli · error · Error

PowerShell execution failed with status

Error message

PowerShell execution failed with status ${res.status}: ${res.stderr || res.stdout}

What it means

The PowerShell security-validation script exited with a nonzero status, meaning the batch path check itself failed (script error, bad input, or environment problem) rather than the paths being insecure. Its exit code and captured stderr/stdout are embedded in the message.

Solutions

  1. Inspect res.stderr/res.stdout in the message for the script's error output
  2. Verify the PowerShell path and execution policy on the machine
  3. Check that the input paths are well-formed for the batch script
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/core/src/utils/security.ts:337 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of google-gemini/gemini-cli@6a466a7e2f (2026-09-16). Data as JSON: /api/errors/9f2e1244d87510e3. Report an issue: GitHub.

Appendix: source

Thrown at packages/core/src/utils/security.ts:337

        '-NoProfile',
        '-NonInteractive',
        '-ExecutionPolicy',
        'Bypass',
        '-EncodedCommand',
        encodedScript,
      ],
      { encoding: 'utf-8', timeout: 5000 },
    );

    if (res.error) {
      if ((res.error as NodeJS.ErrnoException).code === 'ETIMEDOUT') {
        throw new Error(`Security validation timed out after 5000ms`);
      }
      throw res.error;
    }

    if (res.status !== 0) {
      throw new Error(
        `PowerShell execution failed with status ${res.status}: ${res.stderr || res.stdout}`,
      );
    }

    const batchResults = parseWindowsBatchSecurityOutput(
      res.stdout ?? '',
      uncached,
    );

    for (const p of uncached) {
      const parsed = batchResults.get(p) ?? {};
      let isDir = false;
      try {
        isDir = fsSync.statSync(p).isDirectory();
      } catch {
        // Leave isDir false if stat fails
      }
      const result = formatWindowsSecurityResult(parsed, p, isDir);

View on GitHub (pinned to 6a466a7e2f)