google-gemini/gemini-cli · critical · FatalToolExecutionError

Error executing tool ${event.name}: ${displayText || errorMs

Error message

Error executing tool ${event.name}: ${displayText || errorMsg}

What it means

Thrown when a tool event carries errorType === ToolErrorType.NO_SPACE_LEFT. This is the only tool error type classified as fatal (see isFatalToolError), because disk-full is an unrecoverable system state. It becomes a FatalToolExecutionError (exit code 54) and the CLI exits immediately rather than letting the model retry.

Source

Thrown at packages/cli/src/nonInteractiveCliAgentSession.ts:537

              const displayText = displayContentToString(display);
              const errorMsg = getTextContent(event.content) ?? 'Tool error';

              if (event.data?.['errorType'] === ToolErrorType.STOP_EXECUTION) {
                if (
                  config.getOutputFormat() === OutputFormat.JSON &&
                  !responseText &&
                  preToolResponseText
                ) {
                  responseText = preToolResponseText;
                }
                const stopMessage = `Agent execution stopped: ${errorMsg}`;
                if (config.getOutputFormat() === OutputFormat.TEXT) {
                  process.stderr.write(`${stopMessage}\n`);
                }
              }

              if (event.data?.['errorType'] === ToolErrorType.NO_SPACE_LEFT) {
                throw new FatalToolExecutionError(
                  'Error executing tool ' +
                    event.name +
                    ': ' +
                    (displayText || errorMsg),
                );
              }
              handleToolError(
                event.name,
                new Error(errorMsg),
                config,
                typeof event.data?.['errorType'] === 'string'
                  ? event.data['errorType']
                  : undefined,
                displayText,
              );
            }
            break;
          }

View on GitHub (pinned to 5024443c72)

Solutions

  1. Free disk space on the working volume (delete temp files, clear caches, prune docker) and confirm with `df -h`.
  2. Move the workspace/target directory to a volume with adequate free space.
  3. Raise the size limit if running inside a capped container/overlay/tmpfs.
  4. Re-run the session once free space is confirmed; partial writes from the failed turn should be cleaned up.
Defensive patterns

Strategy: try-catch

Validate before calling

import fs from 'node:fs';

function freeBytesForPath(p: string): number {
  return fs.statfsSync(p).bavail * fs.statfsSync(p).bsize;
}
// guard before long write-heavy sessions
if (freeBytesForPath(workspaceRoot) < 500 * 1024 * 1024) {
  throw new Error('Less than 500MB free; tool writes may fail with NO_SPACE_LEFT');
}

Type guard

import { ToolErrorType } from '@google/gemini-cli-core';
function isNoSpaceLeft(errorType?: string): boolean {
  return errorType === ToolErrorType.NO_SPACE_LEFT;
}

Try / catch

try {
  await runAgentSession(input);
} catch (e) {
  if (e instanceof FatalToolExecutionError) {
    // exit code 54: disk full (NO_SPACE_LEFT). Free space then re-run.
    console.error('Disk full. Free space on', workspaceRoot, 'and retry.');
    process.exit(54);
  }
  throw e;
}

Prevention

When it happens

Trigger: A tool (typically write-file, edit, or shell) performed a filesystem write that failed with ENOSPC; the tool sets errorType = NO_SPACE_LEFT, which the agent-session loop detects on the tool event and re-throws as FatalToolExecutionError.

Common situations: Target disk/partition is full; writing into a tmpfs/overlay with a low size cap (containers, CI); a runaway log/output filled the volume mid-session.

Related errors


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