google-gemini/gemini-cli · warning

Installation aborted: Folder "${absolutePath}" is not truste

Error message

Installation aborted: Folder "${absolutePath}" is not trusted.

What it means

When installing a local or linked extension, if the source folder is not already trusted (isWorkspaceTrusted() returns false) and the consent prompt is declined, installation aborts. Trusting a folder is a security gate: it allows the CLI to load the folder's commands, hooks, MCP servers, agent skills, and settings — any of which could execute code on the user's behalf.

Source

Thrown at packages/cli/src/commands/extensions/install.ts:139

          }
          promptLines.push('');
        }

        promptLines.push(
          chalk.yellow(
            'Do you want to trust this folder and continue with the installation? [y/N]: ',
          ),
        );

        const confirmed = await promptForConsentNonInteractive(
          promptLines.join('\n'),
          false,
        );
        if (confirmed) {
          const trustedFolders = loadTrustedFolders();
          await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
        } else {
          throw new Error(
            `Installation aborted: Folder "${absolutePath}" is not trusted.`,
          );
        }
      }
    }

    const requestConsent = args.consent
      ? () => Promise.resolve(true)
      : requestConsentNonInteractive;
    if (args.consent) {
      debugLogger.log('You have consented to the following:');
      debugLogger.log(INSTALL_WARNING_MESSAGE);
    }

    const extensionManager = new ExtensionManager({
      workspaceDir,
      requestConsent,
      requestSetting: args.skipSettings ? null : promptForSetting,

View on GitHub (pinned to 5024443c72)

Solutions

  1. Pre-trust the folder using the trusted folders configuration before running install.
  2. Run in an interactive terminal and answer 'y' to the trust prompt.
  3. Only install extensions from reviewed and trusted sources.
  4. Use the FolderTrustDiscoveryService output in the prompt to review what the folder contains before trusting.
Defensive patterns

Strategy: validation

Validate before calling

import { loadTrustedFolders, TrustLevel } from '../../config/trustedFolders.js';
import { getRealPath } from '@google/gemini-cli-core';

async function preTrustFolder(absolutePath: string): Promise<void> {
  const realPath = getRealPath(absolutePath);
  const trustedFolders = loadTrustedFolders();
  await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
}

// Before installing from a known-safe local path:
await preTrustFolder(path.resolve(source));

Try / catch

try {
  await handleInstall(args);
} catch (e) {
  if (e instanceof Error && e.message.includes('is not trusted')) {
    console.error('Trust the folder first or run in an interactive terminal.');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Installing from a local path where isWorkspaceTrusted() returns false, and promptForConsentNonInteractive() returns false. In non-interactive environments (CI, pipes), the prompt defaults to declining unless consent mechanisms are configured.

Common situations: Installing from an untrusted directory in CI/non-interactive mode where the consent prompt cannot be answered; user deliberately declines the trust prompt for security; first-time install from a new local source.

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/3a596bb7b6c51291. Report an issue: GitHub.