A RenderFlex overflowed by pixels on the right

A RenderFlex overflowed by 42 pixels on the right.

Quick Answer

A Row or Column child is too large for the available space.

Why This Happens

In Flutter, this happens when a child widget inside a Row or Column exceeds the available space along the main axis. The rendering engine cannot clip or scroll the overflow by default, so it throws this error. Wrapping the overflowing child in Expanded, Flexible, or a scrollable widget resolves it.

The Problem

Row(
  children: [
    Text('A very long text that will overflow the row widget boundaries'),
    Icon(Icons.star),
  ],
)

The Fix

Row(
  children: [
    Expanded(
      child: Text(
        'A very long text that will overflow the row widget boundaries',
        overflow: TextOverflow.ellipsis,
      ),
    ),
    Icon(Icons.star),
  ],
)

Step-by-Step Fix

  1. 1

    Identify the error

    Look at the error message: A RenderFlex overflowed by X pixels. This tells you a Row or Column child exceeds the available space.

  2. 2

    Find the cause

    Check which Row or Column in your widget tree contains children that are too wide or too tall for the parent constraints.

  3. 3

    Apply the fix

    Wrap the overflowing child in Expanded or Flexible, or add overflow handling like TextOverflow.ellipsis for text widgets.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free