Skip to content

Incorrect line numbers for coroutines in GDScript stack traces #106489

Closed
@limbonaut

Description

@limbonaut

Tested versions

  • Reproducible in 4.0-stable, 4.3-stable and the recent 4.4.1-stable (must be an old issue)
  • Reproducible in 4.5-dev4
  • Not reproducible with dev_build=yes

Tested on Linux and macOS.

System information

Godot v4.5.dev4 - Arch Linux #1 SMP PREEMPT_DYNAMIC Fri, 02 May 2025 06:44:33 +0000 on Wayland - Wayland display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 threads)

Issue description

GDScript stack traces involving coroutines do not report proper line numbers:

Screenshot 2025-04-23 at 21 51 43

f1, f2, f3 are coroutines.

Originally posted by @limbonaut in #91006 (review)

This is unrelated to the script backtrace PR, as I can reproduce it on stable versions as well:

Image

Steps to reproduce

MRP provided. Run a project with the following script to trigger an error and check the Debugger -> Stack Trace:

extends Node2D


func _ready() -> void:
	await f1()
	var a
	a.hello() # trigger nullref access error


func f1():
	print("starting f1")
	await f2()
	print("finishing f1")


func f2():
	print("starting f2")
	await f3()
	print("finishing f2")


func f3():
	print("starting f3")
	await get_tree().process_frame
	print("finishing f3")

You should see something similar in the editor:

Image

Note the line numbers in the stack trace.

UPDATE:
Make sure you are building with dev_build=no. Apparently it's not reproducible with dev_build=yes.

Minimal reproduction project (MRP)

mrp-coroutine-stack-trace-issue.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Very Bad

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions