# Expected indented block after function declaration in Godot 4

Every func needs a body indented one level under it, and this one has none. func _ready(): followed by an unindented line fails to parse with Expected indented block after function declaration. Indent the body under the func line, or write pass for a function that does nothing yet.

Source: https://flockbay.com/godot/expected-indented-block-after-function-declaration/ · Updated 2026-10-30

## What Godot is checking

After the colon of a function declaration the parser expects a new line that is indented deeper than the func line. A line at the same depth, or the end of the file, means the function has no body.

The same rule names other blocks: Expected indented block after "if" block, after "for" block, after class declaration.

## Reproduce it

A _ready() whose body was not indented.

```
extends Node

func _ready() -> void:
print("no indent")

```

## What Godot 4.7.2 prints

```
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: Expected indented block after function declaration.
   at: GDScript::reload (res://answers/expected-indented-block-after-function-declaration/repro.gd:3)
ERROR: Failed to load script "res://answers/expected-indented-block-after-function-declaration/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)
```

## Fix it

Indent the body, and use pass for an empty function.

```
extends Node

func _ready() -> void:
	print("indented")

func _on_timeout() -> void:
	pass

```

## What the fixed script prints

```
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

indented
```

## Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

```
My Godot 4 project prints this error: "Parse Error: Expected indented block after function declaration.". Find where it comes from and fix it. Every func needs a body indented one level under it, and this one has none. func _ready(): followed by an unindented line fails to parse with Expected indented block after function declaration. Indent the body under the func line, or write pass for a function that does nothing yet. Then run the game headless and check that Godot's output no longer shows it.
```

## Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_parser.cpp line 1956, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L1956).

## Questions

### What is pass for?

It is a statement that does nothing, for a block that must exist but has no code yet.

### Why does the error point at the func line?

The parser reports where the block it expected should have started, which is the line with the colon.

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [Used tab character for indentation instead of space as used before in the file in Godot 4](/godot/used-tab-character-for-indentation-instead-of-space/), [Unexpected identifier "…" in class body in Godot 4](/godot/unexpected-identifier-in-class-body/), [Expected end of statement after variable declaration, found "Identifier" instead in Godot 4](/godot/expected-end-of-statement-after-variable-declaration/), [Identifier "…" not declared in the current scope in Godot 4](/godot/identifier-not-declared-in-the-current-scope/), [Does Godot use Python? No: GDScript looks like Python, and here is where it is not](/godot/does-godot-use-python/), [Every verified Godot 4 answer](/godot/), [How do I see Godot’s output and errors in Flockbay?](/docs/how-do-i-see-godots-output-in-flockbay/)
