Skip to content

Nonexistent function 'rpc' in base 'Callable' #78545

Closed
@AncRad

Description

@AncRad

Godot version

v4.1.dev3.official [a67d37f]

System information

Linux 5.4.0-135-generic

Issue description

I am trying to call Callable.rpc() and Callable.rpc_id(...) method but it doesn't work with some Callable.
If I call the .bind method and then call .rpc, I get the error "Invalid call. Nonexistent function 'rpc' in base 'Callable'.", execution aborts.

Issue is that we know for sure that the .rpc method in the Callable type is always present, and we would get a different error, but definitely not this one.

Steps to reproduce

Create an empty project, a new scene with Node at the root, and attach the following script to it:

extends Node

@rpc
func foo(value = null):
	print("foo(%s)" % value)

func _ready():
	
	rpc("foo") # ok
	
	rpc("foo", 123) # ok
	
	foo.rpc() # ok
	
	foo.rpc(123) # ok
	
	foo.bind(123).rpc() # error: "invalid call. Nonexistent function 'rpc' in base 'Callable'."
	
	foo.bindv([123]).rpc() # error: "invalid call. Nonexistent function 'rpc' in base 'Callable'."
	
	foo.bind(123).unbind(1).rpc() # error: "invalid call. Nonexistent function 'rpc' in base 'Callable'."
	
	foo.bindv([123]).unbind(1).rpc() # error: "invalid call. Nonexistent function 'rpc' in base 'Callable'."
	

Run the scene and observe the error. After an error, execution is interrupted, so comment out the found line to find the next error. Run the scene again.

See all available function values for these Callables. Except Callable.get_method() but that's a whole other issue.

	for callable in [foo, foo.bind(123), foo.bindv([123]), foo.bind(123).unbind(1), foo.bindv([123]).unbind(1)]:
		print("%6s ".repeat(11) % [
			callable,
			callable.get_bound_arguments(), callable.get_bound_arguments_count(), "callable.get_method()", callable.get_object(), callable.get_object_id(),
			callable.hash(), callable.is_custom(), callable.is_null(), callable.is_standard(), callable.is_valid()
		])

Minimal reproduction project

N / A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions