[SOLVED] Could not find return label

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Kinmoku
Miko-Class Veteran
Posts: 560
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: Love IRL, Memories
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

[SOLVED] Could not find return label

#1 Post by Kinmoku » Tue Mar 22, 2016 8:02 am

Hello. I've run into an odd error. When I try and finish the game it comes up with this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 2524, in script
    return
Exception: Could not find return label (.../Documents/Game/One Night Stand/game/script.rpy', 1458288718, 133).

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 2524, in script
    return
  File "/Applications/renpy-6.99.9-sdk/renpy/ast.py", line 1368, in execute
    next_node(renpy.game.context().lookup_return(pop=True))
  File "/Applications/renpy-6.99.9-sdk/renpy/execution.py", line 523, in lookup_return
    raise Exception("Could not find return label {!r}.".format(self.return_stack[-1]))
Exception: Could not find return label (.../Documents/Game/One Night Stand/game/script.rpy', 1458288718, 133).

Darwin-14.0.0-x86_64-i386-64bit
Ren'Py 6.99.9.1168
One Night Stand 0.0
and "return" is in the script. I've updated Renpy and deleted my cache/ persistant data. Any ideas?
Last edited by Kinmoku on Tue Mar 22, 2016 1:32 pm, edited 1 time in total.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Could not find return label

#2 Post by xela » Tue Mar 22, 2016 8:37 am

You've messed up the return stack somehow. No way of knowing how without seeing the whole code, but the chances are that it's your fault ;)
Like what we're doing? Support us at:
Image

User avatar
Kinmoku
Miko-Class Veteran
Posts: 560
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: Love IRL, Memories
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Could not find return label

#3 Post by Kinmoku » Tue Mar 22, 2016 8:48 am

Ah ha, I was afraid of that! What's the easiest way for me to check where I've gone wrong? I've looked over the code briefly and it seems ok to me.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Could not find return label

#4 Post by xela » Tue Mar 22, 2016 11:50 am

I can only imagine how this happens... you could have messed up the stack by implicitly interfering with it or doing something insane like going out of the games context for no reason (although return should then plainly return you back to games context). I cannot come up with a simple way to do it while following the general coding guidelines for Ren'Py. Last index on call stack returns None for you, I don't know why :( If I were to try and replicate this, creating a save file while in a called label and then delete the label where the call originated would be a (reasonable) place to start, but you never said anything about loading a save and I am not 100% sure that it'll cause the error to occur.

As I've said, the chances are that you may not even get this error outside of dev mode. If you figure out what it is, please let me know, I'd like to know how that can happen without explicit interference (which I am fairly certain you didn't do, cause it's neither easy, nor is it something you'd randomly do).
Like what we're doing? Support us at:
Image

User avatar
Kinmoku
Miko-Class Veteran
Posts: 560
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: Love IRL, Memories
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Could not find return label

#5 Post by Kinmoku » Tue Mar 22, 2016 1:10 pm

Ok, this is so weird. It's stopped doing it now! I swear I haven't changed any of the calls, jumps, returns or updated or anything! That's so weird... But at least it's fixed!

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Could not find return label

#6 Post by mobychan » Tue Mar 22, 2016 1:15 pm

I mostly get that error when I delete the label/a bigger portion of the text where I'm in the game when it automatically reloads.
restarting from main menu/somewhere that still exists is the easiest fix I guess.
Shouldn't happen in a finished game ^^

User avatar
Kinmoku
Miko-Class Veteran
Posts: 560
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: Love IRL, Memories
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Could not find return label

#7 Post by Kinmoku » Tue Mar 22, 2016 1:32 pm

mobychan wrote:I mostly get that error when I delete the label/a bigger portion of the text where I'm in the game when it automatically reloads.
restarting from main menu/somewhere that still exists is the easiest fix I guess.
Shouldn't happen in a finished game ^^
Ah nice! That explains why it seemed to just fix itself :) Thanks!
Last edited by Kinmoku on Wed Mar 23, 2016 4:26 am, edited 1 time in total.

User avatar
Nylan
Regular
Posts: 47
Joined: Tue Mar 08, 2016 4:11 am
Completed: Segmentation_Fault (Nano16)
Projects: Currently free
Organization: MagicEngineering
Contact:

Re: Could not find return label

#8 Post by Nylan » Tue Mar 22, 2016 1:38 pm

This is a bit technical, but it can help with understanding basic stack principles: http://www.cs.umd.edu/class/sum2003/cms ... stack.html

TL;DR you probably accessed something outside of the part of the code you were in. When calling a function, only globals (that have already been initialized) and stuff from within the function you called works, generally speaking. Editing live code will often bork that up.

Glad it's straightened out. :)
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]