How do I decode error G_IO_QUARK from g_dbus_connection_call_sync()?


This is g_dbus_connection_call_sync GError return.

I see this in DBUS-Monitor:

error time=1662507400.884091 sender=:1.128 -> destination=:1.813 error_name=org.bluez.Error.DoesNotExist reply_serial=28
   string "Does Not Exist"

When I try to decode it, I get:

domain 179 0xb3: code 36 0x24

g_quark_to_string(error->domain) gives me:

Domain: g-io-error-quark

What is the correct way to decode this error?

Not sure entirely what you want to decode, but you probably want to see Gio.DBusError which has some related functions and maybe Error Reporting.

Edit: Oh I missed that this was bluez, in which case device-api.txt may be useful.

What I meant is a header file.

Looking in adapter-api.txt, it is missing:


But I see in BlueZ src/error.c:

DBusMessage *btd_error_does_not_exist(DBusMessage *msg)
return g_dbus_create_error(msg, ERROR_INTERFACE “.DoesNotExist”,
“Does Not Exist”);

So does this mean they only create a text message? I didn’t really want to have to scan a text message. I was hoping for a domain and code value.

Well I think D-Bus has it’s own error thing; GIO just has some utility functions for working with them. A GError looks like this:

struct GError {
  GQuark       domain;
  gint         code;
  gchar       *message;

So you can get the attributes of it with error->domain, error->code and error->message. Typically you will check against known errors like:

if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED)
  // etc

G_DBUS_ERROR_FAILED and G_IO_ERROR_FAILED are codes you get when there isn’t a more appropriate code like G_DBUS_ERROR_UNKNOWN_OBJECT, which may be the error code in your case.

DoesNotExist is on line #120 of device-api.txt, incidentally.

Here is what seems to work:


That matches the code, and is a general error.

To get the bluez error you must do:


This will contain something like:


Thanks for the help.

1 Like