Output error spam caused by seemingly nothing

Godot Version

v4.2.2

Question

Alright so I’ve been working with JeanKouss’ Third Person Camera asset from the AssetLib tab. I modified it a little bit to allow it to take inputs that I defined as by default it only allows mouse inputs to move the camera around. However, despite me having the InputMap actions “CStickUp”, “CStickDown”, “CStickRight” and “CStickLeft” defined in an image below still causes the code below to spit out the errors below.
(the inputmaps, code and errors)

This isn’t the only case of this I have either, there is another one which is caused by me trying to get my player controller to rotate with the camera using a tween via referencing it using get_parent() as soon as possible and keeping it in an if statement that checks for it not being null to ensure that it wouldn’t cause an issue like this.
(the code and errors in question)

I know at the very least that these errors are being thrown because the function that this code is contained in is called by a _physics_process() subroutine that apparently can go off even in the editor? (haven’t seen that before in an engine, kinda neat though)

The annoying thing is both of these still work as intended, it just spews these error messages which I’d like to get rid of since they’re pretty inconvenient for trying to debug genuine problems with my code and have actually caused godot to crash a couple times for me (or at least I think since it wasn’t crashing until this started happening).

Any help would be appreciated.
(apologies for the images being cobbled together google drive embeds - please I’m begging you godot discourse admins don’t limit new users so much)

Edit: With some tinkering I did manage to fix the InputMap issue myself. Turns out all I had to do to make the errors disappear was just add an

if InputMap.has_action("CStickLeft"):

before each usage of the InputMaps which stopped the errors from appearing and still allowed it to work.

The second issue: You’re trying to rotate the subviewport, but as the error says viewports don’t have a global_rotation property, you can’t rotate them. I’m guessing you’re trying to rotate the camera?
Because of this error tween_property returns null, and you’re calling as_relative() on that, that’s the “null value” error.

Not quite unfortunately. I think it IS picking up ParentObject as being a SubViewport whatever those are (which is very confusing cuz in actual functionality it’s either null or set to be a CharacterBody3D). I’m not trying to rotate the camera though - the part above the bit circled is the camera rotation code which is fine whereas the circled code is the object that I’m trying to rotate (a CharacterBody3D, or the parent of the object this script is attached to) which is throwing all the errors.


The null value error makes even less sense if the above is true because that means it’s simultaneously a SubViewport but also null??

Parent object is not null, it’s tween_property that returns null, because it’s set to tween a property that doesn’t exist.

Anyway, are you reparenting this node at runtime?
You call ParentObject = get_parent() in the _ready() function, and it stores the parent, which is the subviewport at the time.
If you reparent it, ParentObject is still the subviewport, not the current parent, unless you call ParentObject = get_parent() again after reparenting, to store the new parent in ParentObject.

It is returning null that’s true but it’s also just working as intended in runtime. My issue is the fact that it’s erroring despite it seemingly working.

I’m not reparenting the node but I am getting the parent at runtime
image
which is very confusing because surely if it’s happening at the beginning of runtime then during runtime it shouldn’t be an issue - though it happens in the editor too which is my main concern with it so even still the problem’s still there.

Unfortunately I’ve already tried the “switch it off switch it back on again” strategy just incase if it was just a one time thing.

OK I managed to fix all of my issues myself through some further tinkering.
To reiterate from the top post I managed to fix the InputMap issue by wrapping all of the uses of InputMap in a has_action usage like so:

if InputMap.has_action("CStickLeft"):

For the rotation problem, for some reason creating an entirely new variable that wasn’t ParentObject and then replacing all instances of ParentObject with it just kinda fixed the issue?? I guess ParentObject could be some kind of global value that I wasn’t aware of but whatever the case is replacing the variable completely fixed the issue and still allowed the system to work.