Flutter: RenderBox was not laid out: RenderFlex#a1b2c relayoutBoundary=up2 NEEDS-PAINT — Failed assertion: 'hasSize'
A widget was asked for its size or painted before layout finished, usually because a parent gave it unbounded or conflicting constraints.
RenderBox was not laid outFailed assertion: line 1930 pos 12: 'hasSize'RenderBox was not laid out: RenderFlex'package:flutter/src/rendering/box.dart': Failed assertion: 'hasSize'relayoutBoundary=up NEEDS-PAINT Meaning
This is often a follow-on error: the first red error above it (unbounded height/width, infinite size) is the real cause. Fix that first. Typical triggers are a ListView/Column inside another scrollable or Row, or Expanded used outside a Flex parent.
Common causes
- ListView or Column nested without bounded height
- Expanded/Flexible inside a non-Flex parent
- TextField or other box inside a Row without width constraint
- Widget with no size placed in a Stack without Positioned
- Cascade from an earlier layout exception
⚡ Quick fix
- Scroll up to the first exception in the log and fix that one
- Wrap the nested list in
ExpandedorSizedBox(height: …) - Set
shrinkWrap: trueon an inner ListView when appropriate
Detailed fix by platform
Flutter
- Open DevTools → Flutter Inspector → Enable "Debug paint" to see which box has no size
How to diagnose
- First error — Which exception appears first?
- Parent — Bounded constraints?
- Widget — Expanded under Flex?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- Android license status unknown / licenses not accepted flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses
- BoxConstraints forces an infinite width Flutter: BoxConstraints forces an infinite width. These invalid constraints were provided to RenderStack's layout() function (TextField in a Row)
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
- SocketException: Failed host lookup Flutter: Unhandled Exception: SocketException: Failed host lookup: 'api.example.com' (OS Error: No address associated with hostname, errno = 7)
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026