diff --git a/balloon.c b/balloon.c
index e02ab1c..a8bf9b6 100644
--- a/balloon.c
+++ b/balloon.c
@@ -99,14 +99,14 @@ BalloonInfo *qmp_query_balloon(Error **errp)
     BalloonInfo *info;
 
     if (kvm_enabled() && !kvm_has_sync_mmu()) {
-        error_set(errp, QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");
+        error_set(errp, /* QERR_KVM_MISSING_CAP */ 38, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon");
         return NULL;
     }
 
     info = g_malloc0(sizeof(*info));
 
     if (qemu_balloon_status(info) == 0) {
-        error_set(errp, QERR_DEVICE_NOT_ACTIVE, "balloon");
+        error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "balloon");
         qapi_free_BalloonInfo(info);
         return NULL;
     }
@@ -117,16 +117,16 @@ BalloonInfo *qmp_query_balloon(Error **errp)
 void qmp_balloon(int64_t value, Error **errp)
 {
     if (kvm_enabled() && !kvm_has_sync_mmu()) {
-        error_set(errp, QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");
+        error_set(errp, /* QERR_KVM_MISSING_CAP */ 38, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon");
         return;
     }
 
     if (value <= 0) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "target", "a size");
         return;
     }
     
     if (qemu_balloon(value) == 0) {
-        error_set(errp, QERR_DEVICE_NOT_ACTIVE, "balloon");
+        error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "balloon");
     }
 }
diff --git a/block.c b/block.c
index ce7eb8f..c8d418a 100644
--- a/block.c
+++ b/block.c
@@ -4034,7 +4034,7 @@ void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
     BlockJob *job;
 
     if (bs->job || bdrv_in_use(bs)) {
-        error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
+        error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", bdrv_get_device_name(bs));
         return NULL;
     }
     bdrv_set_in_use(bs, 1);
@@ -4079,7 +4079,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
     Error *local_err = NULL;
 
     if (!job->job_type->set_speed) {
-        error_set(errp, QERR_NOT_SUPPORTED);
+        error_set(errp, /* QERR_NOT_SUPPORTED */ 44, "Not supported");
         return;
     }
     job->job_type->set_speed(job, speed, &local_err);
diff --git a/block/qcow.c b/block/qcow.c
index e820099..0b1f87c 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -180,9 +180,7 @@ static int qcow_open(BlockDriverState *bs, int flags)
     }
 
     /* Disable migration when qcow images are used */
-    error_set(&s->migration_blocker,
-              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-              "qcow", bs->device_name, "live migration");
+    error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "qcow", bs->device_name, "live migration");
     migrate_add_blocker(s->migration_blocker);
 
     qemu_co_mutex_init(&s->lock);
diff --git a/block/stream.c b/block/stream.c
index 37c4652..8ddaa59 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -168,7 +168,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
     StreamBlockJob *s = container_of(job, StreamBlockJob, common);
 
     if (speed < 0) {
-        error_set(errp, QERR_INVALID_PARAMETER, "speed");
+        error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "speed");
         return;
     }
     ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
diff --git a/block/vdi.c b/block/vdi.c
index 57325d6..dadde29 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -440,9 +440,7 @@ static int vdi_open(BlockDriverState *bs, int flags)
     }
 
     /* Disable migration when vdi images are used */
-    error_set(&s->migration_blocker,
-              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-              "vdi", bs->device_name, "live migration");
+    error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vdi", bs->device_name, "live migration");
     migrate_add_blocker(s->migration_blocker);
 
     return 0;
diff --git a/block/vmdk.c b/block/vmdk.c
index 18e9b4c..49ee6cd 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -663,9 +663,7 @@ static int vmdk_open(BlockDriverState *bs, int flags)
     qemu_co_mutex_init(&s->lock);
 
     /* Disable migration when VMDK images are used */
-    error_set(&s->migration_blocker,
-              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-              "vmdk", bs->device_name, "live migration");
+    error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vmdk", bs->device_name, "live migration");
     migrate_add_blocker(s->migration_blocker);
 
     return 0;
diff --git a/block/vpc.c b/block/vpc.c
index 5cd13d1..662e3f8 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -255,9 +255,7 @@ static int vpc_open(BlockDriverState *bs, int flags)
     qemu_co_mutex_init(&s->lock);
 
     /* Disable migration when VHD images are used */
-    error_set(&s->migration_blocker,
-              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-              "vpc", bs->device_name, "live migration");
+    error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vpc", bs->device_name, "live migration");
     migrate_add_blocker(s->migration_blocker);
 
     return 0;
diff --git a/block/vvfat.c b/block/vvfat.c
index 7b1dcee..cf9e9eb 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1091,9 +1091,7 @@ DLOG(if (stderr == NULL) {
 
     /* Disable migration when vvfat is used rw */
     if (s->qcow) {
-        error_set(&s->migration_blocker,
-                  QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-                  "vvfat (rw)", bs->device_name, "live migration");
+        error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vvfat (rw)", bs->device_name, "live migration");
         migrate_add_blocker(s->migration_blocker);
     }
 
diff --git a/blockdev.c b/blockdev.c
index 6060c88..e737d2f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -739,29 +739,29 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
 
         drv = bdrv_find_format(format);
         if (!drv) {
-            error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
+            error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format);
             goto delete_and_fail;
         }
 
         states->old_bs = bdrv_find(device);
         if (!states->old_bs) {
-            error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+            error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
             goto delete_and_fail;
         }
 
         if (!bdrv_is_inserted(states->old_bs)) {
-            error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
+            error_set(errp, /* QERR_DEVICE_HAS_NO_MEDIUM */ 12, "Device 'device=%s' has no medium", device);
             goto delete_and_fail;
         }
 
         if (bdrv_in_use(states->old_bs)) {
-            error_set(errp, QERR_DEVICE_IN_USE, device);
+            error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device);
             goto delete_and_fail;
         }
 
         if (!bdrv_is_read_only(states->old_bs)) {
             if (bdrv_flush(states->old_bs)) {
-                error_set(errp, QERR_IO_ERROR);
+                error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred");
                 goto delete_and_fail;
             }
         }
@@ -770,7 +770,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
 
         proto_drv = bdrv_find_protocol(new_image_file);
         if (!proto_drv) {
-            error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
+            error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format);
             goto delete_and_fail;
         }
 
@@ -781,7 +781,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
                                   states->old_bs->drv->format_name,
                                   NULL, -1, flags);
             if (ret) {
-                error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
+                error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", new_image_file);
                 goto delete_and_fail;
             }
         }
@@ -791,7 +791,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp)
         ret = bdrv_open(states->new_bs, new_image_file,
                         flags | BDRV_O_NO_BACKING, drv);
         if (ret != 0) {
-            error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
+            error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", new_image_file);
             goto delete_and_fail;
         }
     }
@@ -828,18 +828,18 @@ exit:
 static void eject_device(BlockDriverState *bs, int force, Error **errp)
 {
     if (bdrv_in_use(bs)) {
-        error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
+        error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", bdrv_get_device_name(bs));
         return;
     }
     if (!bdrv_dev_has_removable_media(bs)) {
-        error_set(errp, QERR_DEVICE_NOT_REMOVABLE, bdrv_get_device_name(bs));
+        error_set(errp, /* QERR_DEVICE_NOT_REMOVABLE */ 23, "Device 'device=%s' is not removable", bdrv_get_device_name(bs));
         return;
     }
 
     if (bdrv_dev_is_medium_locked(bs) && !bdrv_dev_is_tray_open(bs)) {
         bdrv_dev_eject_request(bs, force);
         if (!force) {
-            error_set(errp, QERR_DEVICE_LOCKED, bdrv_get_device_name(bs));
+            error_set(errp, /* QERR_DEVICE_LOCKED */ 16, "Device 'device=%s' is locked", bdrv_get_device_name(bs));
             return;
         }
     }
@@ -853,7 +853,7 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
@@ -867,16 +867,16 @@ void qmp_block_passwd(const char *device, const char *password, Error **errp)
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
     err = bdrv_set_key(bs, password);
     if (err == -EINVAL) {
-        error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
+        error_set(errp, /* QERR_DEVICE_NOT_ENCRYPTED */ 21, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs));
         return;
     } else if (err < 0) {
-        error_set(errp, QERR_INVALID_PASSWORD);
+        error_set(errp, /* QERR_INVALID_PASSWORD */ 34, "Password incorrect");
         return;
     }
 }
@@ -886,21 +886,20 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename,
                                     const char *password, Error **errp)
 {
     if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename);
         return;
     }
 
     if (bdrv_key_required(bs)) {
         if (password) {
             if (bdrv_set_key(bs, password) < 0) {
-                error_set(errp, QERR_INVALID_PASSWORD);
+                error_set(errp, /* QERR_INVALID_PASSWORD */ 34, "Password incorrect");
             }
         } else {
-            error_set(errp, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs),
-                      bdrv_get_encrypted_filename(bs));
+            error_set(errp, /* QERR_DEVICE_ENCRYPTED */ 10, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs));
         }
     } else if (password) {
-        error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
+        error_set(errp, /* QERR_DEVICE_NOT_ENCRYPTED */ 21, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs));
     }
 }
 
@@ -914,14 +913,14 @@ void qmp_change_blockdev(const char *device, const char *filename,
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
     if (format) {
         drv = bdrv_find_whitelisted_format(format);
         if (!drv) {
-            error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
+            error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format);
             return;
         }
     }
@@ -948,7 +947,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
@@ -960,7 +959,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
     io_limits.iops[BLOCK_IO_LIMIT_WRITE]= iops_wr;
 
     if (!do_check_io_limits(&io_limits)) {
-        error_set(errp, QERR_INVALID_PARAMETER_COMBINATION);
+        error_set(errp, /* QERR_INVALID_PARAMETER_COMBINATION */ 31, "Invalid parameter combination");
         return;
     }
 
@@ -1018,12 +1017,12 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
     if (size < 0) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "size", "a >0 size");
         return;
     }
 
@@ -1031,19 +1030,19 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
     case 0:
         break;
     case -ENOMEDIUM:
-        error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
+        error_set(errp, /* QERR_DEVICE_HAS_NO_MEDIUM */ 12, "Device 'device=%s' has no medium", device);
         break;
     case -ENOTSUP:
-        error_set(errp, QERR_UNSUPPORTED);
+        error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
         break;
     case -EACCES:
-        error_set(errp, QERR_DEVICE_IS_READ_ONLY, device);
+        error_set(errp, /* QERR_DEVICE_IS_READ_ONLY */ 15, "Device 'device=%s' is read only", device);
         break;
     case -EBUSY:
-        error_set(errp, QERR_DEVICE_IN_USE, device);
+        error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device);
         break;
     default:
-        error_set(errp, QERR_UNDEFINED_ERROR);
+        error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
         break;
     }
 }
@@ -1096,14 +1095,14 @@ void qmp_block_stream(const char *device, bool has_base,
 
     bs = bdrv_find(device);
     if (!bs) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
         return;
     }
 
     if (base) {
         base_bs = bdrv_find_backing_image(bs, base);
         if (base_bs == NULL) {
-            error_set(errp, QERR_BASE_NOT_FOUND, base);
+            error_set(errp, /* QERR_BASE_NOT_FOUND */ 3, "Base 'base=%s' not found", base);
             return;
         }
     }
@@ -1139,7 +1138,7 @@ void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp)
     BlockJob *job = find_block_job(device);
 
     if (!job) {
-        error_set(errp, QERR_DEVICE_NOT_ACTIVE, device);
+        error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", device);
         return;
     }
 
@@ -1151,7 +1150,7 @@ void qmp_block_job_cancel(const char *device, Error **errp)
     BlockJob *job = find_block_job(device);
 
     if (!job) {
-        error_set(errp, QERR_DEVICE_NOT_ACTIVE, device);
+        error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", device);
         return;
     }
 
diff --git a/cpus.c b/cpus.c
index b182b3d..f72c117 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1246,14 +1246,13 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
     }
 
     if (env == NULL) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
-                  "a CPU number");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number");
         return;
     }
 
     f = fopen(filename, "wb");
     if (!f) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename);
         return;
     }
 
@@ -1263,7 +1262,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
             l = size;
         cpu_memory_rw_debug(env, addr, buf, l, 0);
         if (fwrite(buf, 1, l, f) != l) {
-            error_set(errp, QERR_IO_ERROR);
+            error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred");
             goto exit;
         }
         addr += l;
@@ -1283,7 +1282,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
 
     f = fopen(filename, "wb");
     if (!f) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename);
         return;
     }
 
@@ -1293,7 +1292,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
             l = size;
         cpu_physical_memory_rw(addr, buf, l, 0);
         if (fwrite(buf, 1, l, f) != l) {
-            error_set(errp, QERR_IO_ERROR);
+            error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred");
             goto exit;
         }
         addr += l;
@@ -1317,6 +1316,6 @@ void qmp_inject_nmi(Error **errp)
         }
     }
 #else
-    error_set(errp, QERR_UNSUPPORTED);
+    error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 #endif
 }
diff --git a/dump-stub.c b/dump-stub.c
index 56d4564..537c947 100644
--- a/dump-stub.c
+++ b/dump-stub.c
@@ -21,7 +21,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
                            int64_t begin, bool has_length, int64_t length,
                            Error **errp)
 {
-    error_set(errp, QERR_UNSUPPORTED);
+    error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 int cpu_write_elf64_note(write_core_dump_function f,
diff --git a/dump.c b/dump.c
index 2bf8d8d..7cc27f9 100644
--- a/dump.c
+++ b/dump.c
@@ -721,7 +721,7 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
     s->length = length;
     s->start = get_start_block(s);
     if (s->start == -1) {
-        error_set(errp, QERR_INVALID_PARAMETER, "begin");
+        error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "begin");
         goto cleanup;
     }
 
@@ -741,14 +741,14 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter,
 
     ret = cpu_get_dump_info(&s->dump_info);
     if (ret < 0) {
-        error_set(errp, QERR_UNSUPPORTED);
+        error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
         goto cleanup;
     }
 
     s->note_size = cpu_get_note_size(s->dump_info.d_class,
                                      s->dump_info.d_machine, nr_cpus);
     if (ret < 0) {
-        error_set(errp, QERR_UNSUPPORTED);
+        error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
         goto cleanup;
     }
 
@@ -826,11 +826,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
     int ret;
 
     if (has_begin && !has_length) {
-        error_set(errp, QERR_MISSING_PARAMETER, "length");
+        error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "length");
         return;
     }
     if (!has_begin && has_length) {
-        error_set(errp, QERR_MISSING_PARAMETER, "begin");
+        error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "begin");
         return;
     }
 
@@ -838,7 +838,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
     if (strstart(file, "fd:", &p)) {
         fd = monitor_get_fd(cur_mon, p);
         if (fd == -1) {
-            error_set(errp, QERR_FD_NOT_FOUND, p);
+            error_set(errp, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", p);
             return;
         }
     }
@@ -847,13 +847,13 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
     if  (strstart(file, "file:", &p)) {
         fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
         if (fd < 0) {
-            error_set(errp, QERR_OPEN_FILE_FAILED, p);
+            error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", p);
             return;
         }
     }
 
     if (fd == -1) {
-        error_set(errp, QERR_INVALID_PARAMETER, "protocol");
+        error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol");
         return;
     }
 
@@ -866,7 +866,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
     }
 
     if (create_vmcore(s) < 0 && !error_is_set(s->errp)) {
-        error_set(errp, QERR_IO_ERROR);
+        error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred");
     }
 
     g_free(s);
diff --git a/error.c b/error.c
index acb10a2..a410cc2 100644
--- a/error.c
+++ b/error.c
@@ -21,12 +21,14 @@ struct Error
 {
     QDict *obj;
     char *msg;
+    int err_class;
 };
 
-void error_set(Error **errp, const char *fmt, ...)
+void error_set(Error **errp, int err_class, const char *fmt, ...)
 {
     Error *err;
     va_list ap;
+    char msg[2048];
 
     if (errp == NULL) {
         return;
@@ -35,9 +37,12 @@ void error_set(Error **errp, const char *fmt, ...)
     err = g_malloc0(sizeof(*err));
 
     va_start(ap, fmt);
-    err->obj = qobject_to_qdict(qobject_from_jsonv(fmt, &ap));
+    vsnprintf(msg, sizeof(msg), fmt, ap);
     va_end(ap);
-    err->msg = qerror_format(fmt, err->obj);
+    err->msg = g_strdup(msg);
+
+    err->obj = build_error_dict(err_class, err->msg);
+    err->err_class = err_class;
 
     *errp = err;
 }
@@ -48,6 +53,7 @@ Error *error_copy(const Error *err)
 
     err_new = g_malloc0(sizeof(*err));
     err_new->msg = g_strdup(err->msg);
+    err_new->err_class = err->err_class;
     err_new->obj = err->obj;
     QINCREF(err_new->obj);
 
diff --git a/error.h b/error.h
index 45ff6c1..de98e48 100644
--- a/error.h
+++ b/error.h
@@ -26,7 +26,7 @@ typedef struct Error Error;
  * Currently, qerror.h defines these error formats.  This function is not
  * meant to be used outside of QEMU.
  */
-void error_set(Error **err, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+void error_set(Error **err, int err_class, const char *fmt, ...) GCC_FMT_ATTR(3, 4);
 
 /**
  * Returns true if an indirect pointer to an error is pointing to a valid
diff --git a/hmp.c b/hmp.c
index 6b72a64..ceeb8da 100644
--- a/hmp.c
+++ b/hmp.c
@@ -707,7 +707,7 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
     if (!filename) {
         /* In the future, if 'snapshot-file' is not specified, the snapshot
            will be taken internally. Today it's actually required. */
-        error_set(&errp, QERR_MISSING_PARAMETER, "snapshot-file");
+        error_set(&errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "snapshot-file");
         hmp_handle_error(mon, &errp);
         return;
     }
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index f4a7026..8080582 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -985,8 +985,7 @@ static void v9fs_attach(void *opaque)
                              qid.type, qid.version, qid.path);
     s->root_fid = fid;
     /* disable migration */
-    error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
-              s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
+    error_set(&s->migration_blocker, /* QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION */ 69, "Migration is disabled when VirtFS export path 'path=%s' is mounted in the guest using mount_tag 'tag=%s'", s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
     migrate_add_blocker(s->migration_blocker);
 out:
     put_fid(pdu, fidp);
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index bba21c5..f95cd60 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -681,7 +681,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
     }
 
     if (s->role_val == IVSHMEM_PEER) {
-        error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "ivshmem", "peer mode");
+        error_set(&s->migration_blocker, /* QERR_DEVICE_FEATURE_BLOCKS_MIGRATION */ 11, "Migration is disabled when using feature 'feature=%s' in device 'device=%s'", "ivshmem", "peer mode");
         migrate_add_blocker(s->migration_blocker);
     }
 
diff --git a/hw/pci-stub.c b/hw/pci-stub.c
index e083191..448c21e 100644
--- a/hw/pci-stub.c
+++ b/hw/pci-stub.c
@@ -25,7 +25,7 @@
 
 PciInfoList *qmp_query_pci(Error **errp)
 {
-    error_set(errp, QERR_UNSUPPORTED);
+    error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return NULL;
 }
 
diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c
index b711b6b..c002ecd 100644
--- a/hw/qdev-addr.c
+++ b/hw/qdev-addr.c
@@ -40,7 +40,7 @@ static void set_taddr(Object *obj, Visitor *v, void *opaque,
     int64_t value;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -52,9 +52,7 @@ static void set_taddr(Object *obj, Visitor *v, void *opaque,
     if ((uint64_t)value <= (uint64_t) ~(target_phys_addr_t)0) {
         *ptr = value;
     } else {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
-                  dev->id?:"", name, value, (uint64_t) 0,
-                  (uint64_t) ~(target_phys_addr_t)0);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, value, (uint64_t) 0, (uint64_t) ~(target_phys_addr_t)0);
     }
 }
 
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index db2ed77..6909a6d 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -600,7 +600,7 @@ void qmp_device_del(const char *id, Error **errp)
 
     dev = qdev_find_recursive(sysbus_get_default(), id);
     if (NULL == dev) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, id);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", id);
         return;
     }
 
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 7677cfd..a6a17d7 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -35,7 +35,7 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop,
     int ret;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -73,7 +73,7 @@ static void set_enum(Object *obj, Visitor *v, void *opaque,
     int *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -125,7 +125,7 @@ static void set_bit(Object *obj, Visitor *v, void *opaque,
     bool value;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -165,7 +165,7 @@ static void set_uint8(Object *obj, Visitor *v, void *opaque,
     uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -232,7 +232,7 @@ static void set_uint16(Object *obj, Visitor *v, void *opaque,
     uint16_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -265,7 +265,7 @@ static void set_uint32(Object *obj, Visitor *v, void *opaque,
     uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -290,7 +290,7 @@ static void set_int32(Object *obj, Visitor *v, void *opaque,
     int32_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -363,7 +363,7 @@ static void set_uint64(Object *obj, Visitor *v, void *opaque,
     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -451,7 +451,7 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
     char *str;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -656,7 +656,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
     VLANState *vlan;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -671,8 +671,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
     }
     vlan = qemu_find_vlan(id, 1);
     if (!vlan) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE,
-                  name, prop->info->name);
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, prop->info->name);
         return;
     }
     *ptr = vlan;
@@ -726,7 +725,7 @@ static void set_mac(Object *obj, Visitor *v, void *opaque,
     char *str, *p;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -814,7 +813,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
     char *str;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -826,8 +825,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
         if (local_err) {
             error_propagate(errp, local_err);
         } else if (value < -1 || value > 255) {
-            error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                      "pci_devfn");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "pci_devfn");
         } else {
             *ptr = value;
         }
@@ -884,7 +882,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
     const int64_t max = 32768;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -894,15 +892,13 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
         return;
     }
     if (value < min || value > max) {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
-                  dev->id?:"", name, (int64_t)value, min, max);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, (int64_t)value, min, max);
         return;
     }
 
     /* We rely on power-of-2 blocksizes for bitmasks */
     if ((value & (value - 1)) != 0) {
-        error_set(errp, QERR_PROPERTY_VALUE_NOT_POWER_OF2,
-                  dev->id?:"", name, (int64_t)value);
+        error_set(errp, /* QERR_PROPERTY_VALUE_NOT_POWER_OF2 */ 51, "Property 'device=%s.property=%s' doesn't take value 'value=%"PRId64"', it's not a power of 2", dev->id?:"", name, (int64_t)value);
         return;
     }
 
@@ -952,7 +948,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
     unsigned int slot = 0, func = 0;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
@@ -1059,17 +1055,14 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
 {
     switch (ret) {
     case -EEXIST:
-        error_set(errp, QERR_PROPERTY_VALUE_IN_USE,
-                  object_get_typename(OBJECT(dev)), prop->name, value);
+        error_set(errp, /* QERR_PROPERTY_VALUE_IN_USE */ 49, "Property 'device=%s.property=%s' can't take value 'value=%s', it's in use", object_get_typename(OBJECT(dev)), prop->name, value);
         break;
     default:
     case -EINVAL:
-        error_set(errp, QERR_PROPERTY_VALUE_BAD,
-                  object_get_typename(OBJECT(dev)), prop->name, value);
+        error_set(errp, /* QERR_PROPERTY_VALUE_BAD */ 48, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value);
         break;
     case -ENOENT:
-        error_set(errp, QERR_PROPERTY_VALUE_NOT_FOUND,
-                  object_get_typename(OBJECT(dev)), prop->name, value);
+        error_set(errp, /* QERR_PROPERTY_VALUE_NOT_FOUND */ 50, "Property 'device=%s.property=%s' can't find value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value);
         break;
     case 0:
         break;
diff --git a/hw/qdev.c b/hw/qdev.c
index af54467..390403c 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -199,7 +199,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
 
     if (!dev->parent_bus->allow_hotplug) {
-        error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
+        error_set(errp, /* QERR_BUS_NO_HOTPLUG */ 6, "Bus 'bus=%s' does not support hotplugging", dev->parent_bus->name);
         return;
     }
     assert(dc->unplug != NULL);
@@ -207,7 +207,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
     qdev_hot_removed = true;
 
     if (dc->unplug(dev) < 0) {
-        error_set(errp, QERR_UNDEFINED_ERROR);
+        error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
         return;
     }
 }
@@ -570,7 +570,7 @@ static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
     int ret;
 
     if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
         return;
     }
 
diff --git a/json-parser.c b/json-parser.c
index 849e215..c113064 100644
--- a/json-parser.c
+++ b/json-parser.c
@@ -105,7 +105,7 @@ static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt,
         error_free(ctxt->err);
         ctxt->err = NULL;
     }
-    error_set(&ctxt->err, QERR_JSON_PARSE_ERROR, message);
+    error_set(&ctxt->err, /* QERR_JSON_PARSE_ERROR */ 36, "JSON parse error, message=%s", message);
 }
 
 /**
diff --git a/migration.c b/migration.c
index 8db1b43..d1788c8 100644
--- a/migration.c
+++ b/migration.c
@@ -412,7 +412,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
     params.shared = inc;
 
     if (s->state == MIG_STATE_ACTIVE) {
-        error_set(errp, QERR_MIGRATION_ACTIVE);
+        error_set(errp, /* QERR_MIGRATION_ACTIVE */ 39, "There\'s a migration process in progress");
         return;
     }
 
@@ -438,7 +438,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         ret = fd_start_outgoing_migration(s, p);
 #endif
     } else {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "uri", "a valid migration protocol");
         return;
     }
 
@@ -446,7 +446,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         if (!error_is_set(errp)) {
             DPRINTF("migration failed: %s\n", strerror(-ret));
             /* FIXME: we should return meaningful errors */
-            error_set(errp, QERR_UNDEFINED_ERROR);
+            error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
         }
         return;
     }
diff --git a/monitor.c b/monitor.c
index 0ccca3b..a5ec2c8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -626,8 +626,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
         int ret = monitor_set_cpu(cpu_index);
         if (ret < 0) {
             cur_mon = old_mon;
-            error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
-                      "a CPU number");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number");
             goto out;
         }
     }
@@ -2285,13 +2284,12 @@ void qmp_getfd(const char *fdname, Error **errp)
 
     fd = qemu_chr_fe_get_msgfd(cur_mon->chr);
     if (fd == -1) {
-        error_set(errp, QERR_FD_NOT_SUPPLIED);
+        error_set(errp, /* QERR_FD_NOT_SUPPLIED */ 26, "No file descriptor supplied via SCM_RIGHTS");
         return;
     }
 
     if (qemu_isdigit(fdname[0])) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
-                  "a name not starting with a digit");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "fdname", "a name not starting with a digit");
         return;
     }
 
@@ -2328,7 +2326,7 @@ void qmp_closefd(const char *fdname, Error **errp)
         return;
     }
 
-    error_set(errp, QERR_FD_NOT_FOUND, fdname);
+    error_set(errp, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", fdname);
 }
 
 static void do_loadvm(Monitor *mon, const QDict *qdict)
diff --git a/net.c b/net.c
index abf0fd0..bf4a7c3 100644
--- a/net.c
+++ b/net.c
@@ -1089,7 +1089,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
 
     type = qemu_opt_get(opts, "type");
     if (!type) {
-        error_set(errp, QERR_MISSING_PARAMETER, "type");
+        error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "type");
         return -1;
     }
 
@@ -1105,21 +1105,20 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
             strcmp(type, "vde") != 0 &&
 #endif
             strcmp(type, "socket") != 0) {
-            error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
-                      "a netdev backend type");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "type", "a netdev backend type");
             return -1;
         }
 
         if (qemu_opt_get(opts, "vlan")) {
-            error_set(errp, QERR_INVALID_PARAMETER, "vlan");
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "vlan");
             return -1;
         }
         if (qemu_opt_get(opts, "name")) {
-            error_set(errp, QERR_INVALID_PARAMETER, "name");
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "name");
             return -1;
         }
         if (!qemu_opts_id(opts)) {
-            error_set(errp, QERR_MISSING_PARAMETER, "id");
+            error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "id");
             return -1;
         }
     }
@@ -1154,7 +1153,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
                 ret = net_client_types[i].init(opts, name, vlan);
                 if (ret < 0) {
                     /* TODO push error reporting into init() methods */
-                    error_set(errp, QERR_DEVICE_INIT_FAILED, type);
+                    error_set(errp, /* QERR_DEVICE_INIT_FAILED */ 13, "Device 'device=%s' could not be initialized", type);
                     return -1;
                 }
             }
@@ -1162,8 +1161,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
         }
     }
 
-    error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
-              "a network client type");
+    error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "type", "a network client type");
     return -1;
 }
 
@@ -1275,7 +1273,7 @@ void qmp_netdev_del(const char *id, Error **errp)
 
     vc = qemu_find_netdev(id);
     if (!vc) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, id);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", id);
         return;
     }
 
@@ -1338,7 +1336,7 @@ void qmp_set_link(const char *name, bool up, Error **errp)
 done:
 
     if (!vc) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, name);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", name);
         return;
     }
 
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index 705eca9..e652039 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -107,8 +107,7 @@ void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < 0 || value > UINT8_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "uint8_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint8_t");
                 return;
             }
             *obj = value;
@@ -126,8 +125,7 @@ void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < 0 || value > UINT16_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "uint16_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint16_t");
                 return;
             }
             *obj = value;
@@ -145,8 +143,7 @@ void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < 0 || value > UINT32_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "uint32_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint32_t");
                 return;
             }
             *obj = value;
@@ -178,8 +175,7 @@ void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < INT8_MIN || value > INT8_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "int8_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int8_t");
                 return;
             }
             *obj = value;
@@ -197,8 +193,7 @@ void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < INT16_MIN || value > INT16_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "int16_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int16_t");
                 return;
             }
             *obj = value;
@@ -216,8 +211,7 @@ void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
             value = *obj;
             v->type_int(v, &value, name, errp);
             if (value < INT32_MIN || value > INT32_MAX) {
-                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
-                          "int32_t");
+                error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int32_t");
                 return;
             }
             *obj = value;
@@ -268,7 +262,7 @@ void output_type_enum(Visitor *v, int *obj, const char *strings[],
     assert(strings);
     while (strings[i++] != NULL);
     if (value < 0 || value >= i - 1) {
-        error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");
+        error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", name ? name : "null");
         return;
     }
 
@@ -298,7 +292,7 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[],
     }
 
     if (strings[value] == NULL) {
-        error_set(errp, QERR_INVALID_PARAMETER, enum_str);
+        error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", enum_str);
         g_free(enum_str);
         return;
     }
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 29d6f30..df2c12e 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -27,8 +27,7 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
     QDict *dict = NULL;
 
     if (qobject_type(request) != QTYPE_QDICT) {
-        error_set(errp, QERR_QMP_BAD_INPUT_OBJECT,
-                  "request is not a dictionary");
+        error_set(errp, /* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "request is not a dictionary");
         return NULL;
     }
 
@@ -41,19 +40,18 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
 
         if (!strcmp(arg_name, "execute")) {
             if (qobject_type(arg_obj) != QTYPE_QSTRING) {
-                error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
-                          "string");
+                error_set(errp, /* QERR_QMP_BAD_INPUT_OBJECT_MEMBER */ 56, "QMP input object member 'member=%s' expects 'expected=%s'", "execute", "string");
                 return NULL;
             }
             has_exec_key = true;
         } else if (strcmp(arg_name, "arguments")) {
-            error_set(errp, QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER, arg_name);
+            error_set(errp, /* QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER */ 57, "QMP input object member 'member=%s' is unexpected", arg_name);
             return NULL;
         }
     }
 
     if (!has_exec_key) {
-        error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
+        error_set(errp, /* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "execute");
         return NULL;
     }
 
@@ -76,11 +74,11 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp)
     command = qdict_get_str(dict, "execute");
     cmd = qmp_find_command(command);
     if (cmd == NULL) {
-        error_set(errp, QERR_COMMAND_NOT_FOUND, command);
+        error_set(errp, /* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", command);
         return NULL;
     }
     if (!cmd->enabled) {
-        error_set(errp, QERR_COMMAND_DISABLED, command);
+        error_set(errp, /* QERR_COMMAND_DISABLED */ 8, "The command name=%s has been disabled for this instance", command);
         return NULL;
     }
 
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index a59d4f6..351a4a6 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qmp-input-visitor.c
@@ -70,7 +70,7 @@ static void qmp_input_push(QmpInputVisitor *qiv, QObject *obj, Error **errp)
     GHashTable *h;
 
     if (qiv->nb_stack >= QIV_STACK_SIZE) {
-        error_set(errp, QERR_BUFFER_OVERRUN);
+        error_set(errp, /* QERR_BUFFER_OVERRUN */ 5, "An internal buffer overran");
         return;
     }
 
@@ -104,7 +104,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
             if (g_hash_table_size(top_ht)) {
                 const char *key;
                 g_hash_table_find(top_ht, always_true, &key);
-                error_set(errp, QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER, key);
+                error_set(errp, /* QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER */ 57, "QMP input object member 'member=%s' is unexpected", key);
             }
             g_hash_table_unref(top_ht);
         }
@@ -121,8 +121,7 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,
     Error *err = NULL;
 
     if (!qobj || qobject_type(qobj) != QTYPE_QDICT) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "QDict");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "QDict");
         return;
     }
 
@@ -150,8 +149,7 @@ static void qmp_input_start_list(Visitor *v, const char *name, Error **errp)
     QObject *qobj = qmp_input_get_object(qiv, name);
 
     if (!qobj || qobject_type(qobj) != QTYPE_QLIST) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "list");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "list");
         return;
     }
 
@@ -202,8 +200,7 @@ static void qmp_input_type_int(Visitor *v, int64_t *obj, const char *name,
     QObject *qobj = qmp_input_get_object(qiv, name);
 
     if (!qobj || qobject_type(qobj) != QTYPE_QINT) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "integer");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer");
         return;
     }
 
@@ -217,8 +214,7 @@ static void qmp_input_type_bool(Visitor *v, bool *obj, const char *name,
     QObject *qobj = qmp_input_get_object(qiv, name);
 
     if (!qobj || qobject_type(qobj) != QTYPE_QBOOL) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "boolean");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean");
         return;
     }
 
@@ -232,8 +228,7 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name,
     QObject *qobj = qmp_input_get_object(qiv, name);
 
     if (!qobj || qobject_type(qobj) != QTYPE_QSTRING) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "string");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string");
         return;
     }
 
@@ -248,8 +243,7 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,
 
     if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&
         qobject_type(qobj) != QTYPE_QINT)) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "number");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number");
         return;
     }
 
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 497eb9a..d0eba4e 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -33,8 +33,7 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
         val = strtoll(siv->string, &endp, 0);
     }
     if (!siv->string || errno || endp == siv->string || *endp) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "integer");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer");
         return;
     }
 
@@ -61,8 +60,7 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name,
         }
     }
 
-    error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-              "boolean");
+    error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean");
 }
 
 static void parse_type_str(Visitor *v, char **obj, const char *name,
@@ -72,8 +70,7 @@ static void parse_type_str(Visitor *v, char **obj, const char *name,
     if (siv->string) {
         *obj = g_strdup(siv->string);
     } else {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "string");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string");
     }
 }
 
@@ -89,8 +86,7 @@ static void parse_type_number(Visitor *v, double *obj, const char *name,
         val = strtod(siv->string, &endp);
     }
     if (!siv->string || errno || endp == siv->string || *endp) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
-                  "number");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number");
         return;
     }
 
diff --git a/qemu-config.c b/qemu-config.c
index 5c3296b..09c3be4 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -654,7 +654,7 @@ static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
             break;
     }
     if (lists[i] == NULL) {
-        error_set(errp, QERR_INVALID_OPTION_GROUP, group);
+        error_set(errp, /* QERR_INVALID_OPTION_GROUP */ 29, "There is no option group 'group=%s'", group);
     }
     return lists[i];
 }
diff --git a/qemu-ga.c b/qemu-ga.c
index 8199da7..d1e2b0c 100644
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -511,7 +511,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)
         qdict = qdict_new();
         if (!err) {
             g_warning("failed to parse event: unknown error");
-            error_set(&err, QERR_JSON_PARSING);
+            error_set(&err, /* QERR_JSON_PARSING */ 37, "Invalid JSON syntax");
         } else {
             g_warning("failed to parse event: %s", error_get_pretty(err));
         }
@@ -531,7 +531,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)
             QDECREF(qdict);
             qdict = qdict_new();
             g_warning("unrecognized payload format");
-            error_set(&err, QERR_UNSUPPORTED);
+            error_set(&err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
             qdict_put_obj(qdict, "error", error_get_qobject(err));
             error_free(err);
         }
diff --git a/qemu-option.c b/qemu-option.c
index a351ed9..df24142 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -178,7 +178,7 @@ static void parse_option_bool(const char *name, const char *value, bool *ret,
         } else if (!strcmp(value, "off")) {
             *ret = 0;
         } else {
-            error_set(errp,QERR_INVALID_PARAMETER_VALUE, name, "'on' or 'off'");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "'on' or 'off'");
         }
     } else {
         *ret = 1;
@@ -194,12 +194,12 @@ static void parse_option_number(const char *name, const char *value,
     if (value != NULL) {
         number = strtoull(value, &postfix, 0);
         if (*postfix != '\0') {
-            error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a number");
             return;
         }
         *ret = number;
     } else {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a number");
     }
 }
 
@@ -230,13 +230,13 @@ static void parse_option_size(const char *name, const char *value,
             *ret = (uint64_t) sizef;
             break;
         default:
-            error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a size");
             error_printf_unless_qmp("You may use k, M, G or T suffixes for "
                     "kilobytes, megabytes, gigabytes and terabytes.\n");
             return;
         }
     } else {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
+        error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a size");
     }
 }
 
@@ -629,7 +629,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value,
         if (i == 0) {
             /* empty list -> allow any */;
         } else {
-            error_set(errp, QERR_INVALID_PARAMETER, name);
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", name);
             return;
         }
     }
@@ -761,14 +761,14 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
 
     if (id) {
         if (!id_wellformed(id)) {
-            error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
+            error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "id", "an identifier");
             error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");
             return NULL;
         }
         opts = qemu_opts_find(list, id);
         if (opts != NULL) {
             if (fail_if_exists && !list->merge_lists) {
-                error_set(errp, QERR_DUPLICATE_ID, id, list->name);
+                error_set(errp, /* QERR_DUPLICATE_ID */ 24, "Duplicate ID 'id=%s' for object=%s", id, list->name);
                 return NULL;
             } else {
                 return opts;
@@ -1089,7 +1089,7 @@ void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp)
             }
         }
         if (desc[i].name == NULL) {
-            error_set(errp, QERR_INVALID_PARAMETER, opt->name);
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", opt->name);
             return;
         }
 
diff --git a/qemu-sockets.c b/qemu-sockets.c
index 20def3e..1051740 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -120,7 +120,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
     if ((qemu_opt_get(opts, "host") == NULL) ||
         (qemu_opt_get(opts, "port") == NULL)) {
         fprintf(stderr, "%s: host and/or port not specified\n", __FUNCTION__);
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
         return -1;
     }
     pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port"));
@@ -139,7 +139,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
     if (rc != 0) {
         fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port,
                 gai_strerror(rc));
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
         return -1;
     }
 
@@ -153,7 +153,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
             fprintf(stderr,"%s: socket(%s): %s\n", __FUNCTION__,
                     inet_strfamily(e->ai_family), strerror(errno));
             if (!e->ai_next) {
-                error_set(errp, QERR_SOCK_CREATE_FAILED);
+                error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
             }
             continue;
         }
@@ -179,7 +179,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
                         inet_strfamily(e->ai_family), uaddr, inet_getport(e),
                         strerror(errno));
                 if (!e->ai_next) {
-                    error_set(errp, QERR_SOCK_BIND_FAILED);
+                    error_set(errp, /* QERR_SOCK_BIND_FAILED */ 60, "Failed to bind socket");
                 }
             }
         }
@@ -191,7 +191,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
 
 listen:
     if (listen(slisten,1) != 0) {
-        error_set(errp, QERR_SOCK_LISTEN_FAILED);
+        error_set(errp, /* QERR_SOCK_LISTEN_FAILED */ 64, "Failed to set socket to listening mode");
         perror("listen");
         closesocket(slisten);
         freeaddrinfo(res);
@@ -226,7 +226,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp)
     block = qemu_opt_get_bool(opts, "block", 0);
     if (addr == NULL || port == NULL) {
         fprintf(stderr, "inet_connect: host and/or port not specified\n");
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
         return -1;
     }
 
@@ -239,7 +239,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp)
     if (0 != (rc = getaddrinfo(addr, port, &ai, &res))) {
         fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port,
                 gai_strerror(rc));
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
 	return -1;
     }
 
@@ -274,7 +274,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp)
   #else
         if (!block && (rc == -EINPROGRESS)) {
   #endif
-            error_set(errp, QERR_SOCK_CONNECT_INPROGRESS);
+            error_set(errp, /* QERR_SOCK_CONNECT_INPROGRESS */ 62, "Connection can not be completed immediately");
         } else if (rc < 0) {
             if (NULL == e->ai_next)
                 fprintf(stderr, "%s: connect(%s,%s,%s,%s): %s\n", __FUNCTION__,
@@ -287,7 +287,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp)
         freeaddrinfo(res);
         return sock;
     }
-    error_set(errp, QERR_SOCK_CONNECT_FAILED);
+    error_set(errp, /* QERR_SOCK_CONNECT_FAILED */ 61, "Failed to connect to socket");
     freeaddrinfo(res);
     return -1;
 }
@@ -479,7 +479,7 @@ int inet_listen(const char *str, char *ostr, int olen,
             }
         }
     } else {
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
     }
     qemu_opts_del(opts);
     return sock;
@@ -497,7 +497,7 @@ int inet_connect(const char *str, bool block, Error **errp)
         }
         sock = inet_connect_opts(opts, errp);
     } else {
-        error_set(errp, QERR_SOCK_CREATE_FAILED);
+        error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket");
     }
     qemu_opts_del(opts);
     return sock;
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index ce90421..e881f3e 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -60,8 +60,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
     } else if (strcmp(mode, "reboot") == 0) {
         shutdown_flag = "-r";
     } else {
-        error_set(err, QERR_INVALID_PARAMETER_VALUE, "mode",
-                  "halt|powerdown|reboot");
+        error_set(err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot");
         return;
     }
 
@@ -88,7 +87,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
     }
 
 exit_err:
-    error_set(err, QERR_UNDEFINED_ERROR);
+    error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
 }
 
 typedef struct GuestFileHandle {
@@ -137,7 +136,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E
     slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
     fh = fopen(path, mode);
     if (!fh) {
-        error_set(err, QERR_OPEN_FILE_FAILED, path);
+        error_set(err, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", path);
         return -1;
     }
 
@@ -148,7 +147,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E
     ret = fcntl(fd, F_GETFL);
     ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK);
     if (ret == -1) {
-        error_set(err, QERR_QGA_COMMAND_FAILED, "fcntl() failed");
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fcntl() failed");
         fclose(fh);
         return -1;
     }
@@ -165,13 +164,13 @@ void qmp_guest_file_close(int64_t handle, Error **err)
 
     slog("guest-file-close called, handle: %ld", handle);
     if (!gfh) {
-        error_set(err, QERR_FD_NOT_FOUND, "handle");
+        error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle");
         return;
     }
 
     ret = fclose(gfh->fh);
     if (ret == -1) {
-        error_set(err, QERR_QGA_COMMAND_FAILED, "fclose() failed");
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fclose() failed");
         return;
     }
 
@@ -189,14 +188,14 @@ struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
     size_t read_count;
 
     if (!gfh) {
-        error_set(err, QERR_FD_NOT_FOUND, "handle");
+        error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle");
         return NULL;
     }
 
     if (!has_count) {
         count = QGA_READ_COUNT_DEFAULT;
     } else if (count < 0) {
-        error_set(err, QERR_INVALID_PARAMETER, "count");
+        error_set(err, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "count");
         return NULL;
     }
 
@@ -205,7 +204,7 @@ struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
     read_count = fread(buf, 1, count, fh);
     if (ferror(fh)) {
         slog("guest-file-read failed, handle: %ld", handle);
-        error_set(err, QERR_QGA_COMMAND_FAILED, "fread() failed");
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fread() failed");
     } else {
         buf[read_count] = 0;
         read_data = g_malloc0(sizeof(GuestFileRead));
@@ -232,7 +231,7 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,
     FILE *fh;
 
     if (!gfh) {
-        error_set(err, QERR_FD_NOT_FOUND, "handle");
+        error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle");
         return NULL;
     }
 
@@ -243,14 +242,14 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,
         count = buf_len;
     } else if (count < 0 || count > buf_len) {
         g_free(buf);
-        error_set(err, QERR_INVALID_PARAMETER, "count");
+        error_set(err, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "count");
         return NULL;
     }
 
     write_count = fwrite(buf, 1, count, fh);
     if (ferror(fh)) {
         slog("guest-file-write failed, handle: %ld", handle);
-        error_set(err, QERR_QGA_COMMAND_FAILED, "fwrite() error");
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fwrite() error");
     } else {
         write_data = g_malloc0(sizeof(GuestFileWrite));
         write_data->count = write_count;
@@ -271,14 +270,14 @@ struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,
     int ret;
 
     if (!gfh) {
-        error_set(err, QERR_FD_NOT_FOUND, "handle");
+        error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle");
         return NULL;
     }
 
     fh = gfh->fh;
     ret = fseek(fh, offset, whence);
     if (ret == -1) {
-        error_set(err, QERR_QGA_COMMAND_FAILED, strerror(errno));
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", strerror(errno));
     } else {
         seek_data = g_malloc0(sizeof(GuestFileRead));
         seek_data->position = ftell(fh);
@@ -296,14 +295,14 @@ void qmp_guest_file_flush(int64_t handle, Error **err)
     int ret;
 
     if (!gfh) {
-        error_set(err, QERR_FD_NOT_FOUND, "handle");
+        error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle");
         return;
     }
 
     fh = gfh->fh;
     ret = fflush(fh);
     if (ret == EOF) {
-        error_set(err, QERR_QGA_COMMAND_FAILED, strerror(errno));
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", strerror(errno));
     }
 }
 
@@ -424,7 +423,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
         if (fd == -1) {
             sprintf(err_msg, "failed to open %s, %s", mount->dirname,
                     strerror(errno));
-            error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+            error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
             goto error;
         }
 
@@ -442,7 +441,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
             if (errno != EOPNOTSUPP) {
                 sprintf(err_msg, "failed to freeze %s, %s",
                         mount->dirname, strerror(errno));
-                error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 close(fd);
                 goto error;
             }
@@ -474,8 +473,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
     QTAILQ_INIT(&mounts);
     ret = build_fs_mount_list(&mounts);
     if (ret) {
-        error_set(err, QERR_QGA_COMMAND_FAILED,
-                  "failed to enumerate filesystems");
+        error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to enumerate filesystems");
         return 0;
     }
 
@@ -560,7 +558,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
         if (fd == -1) {
             sprintf(err_msg, "failed to open %s, %s", mount->dirname,
                     strerror(errno));
-            error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+            error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
             goto error;
         }
 
@@ -575,7 +573,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
             if (errno != ENOTTY && errno != EOPNOTSUPP) {
                 sprintf(err_msg, "failed to trim %s, %s",
                         mount->dirname, strerror(errno));
-                error_set(err, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 close(fd);
                 goto error;
             }
@@ -658,7 +656,7 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg,
         case SUSPEND_SUPPORTED:
             return;
         case SUSPEND_NOT_SUPPORTED:
-            error_set(err, QERR_UNSUPPORTED);
+            error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
             return;
         default:
             goto undef_err;
@@ -666,7 +664,7 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg,
     }
 
 undef_err:
-    error_set(err, QERR_UNDEFINED_ERROR);
+    error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
 }
 
 static void guest_suspend(const char *pmutils_bin, const char *sysfile_str,
@@ -727,7 +725,7 @@ static void guest_suspend(const char *pmutils_bin, const char *sysfile_str,
     }
 
 exit_err:
-    error_set(err, QERR_UNDEFINED_ERROR);
+    error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
 }
 
 void qmp_guest_suspend_disk(Error **err)
@@ -785,7 +783,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
     if (getifaddrs(&ifap) < 0) {
         snprintf(err_msg, sizeof(err_msg),
                  "getifaddrs failed: %s", strerror(errno));
-        error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+        error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
         goto error;
     }
 
@@ -823,7 +821,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
             if (sock == -1) {
                 snprintf(err_msg, sizeof(err_msg),
                          "failed to create socket: %s", strerror(errno));
-                error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 goto error;
             }
 
@@ -834,7 +832,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
                          "failed to get MAC address of %s: %s",
                          ifa->ifa_name,
                          strerror(errno));
-                error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 goto error;
             }
 
@@ -847,7 +845,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
                          (int) mac_addr[4], (int) mac_addr[5]) == -1) {
                 snprintf(err_msg, sizeof(err_msg),
                          "failed to format MAC: %s", strerror(errno));
-                error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 goto error;
             }
 
@@ -864,7 +862,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
             if (!inet_ntop(AF_INET, p, addr4, sizeof(addr4))) {
                 snprintf(err_msg, sizeof(err_msg),
                          "inet_ntop failed : %s", strerror(errno));
-                error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 goto error;
             }
 
@@ -886,7 +884,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
             if (!inet_ntop(AF_INET6, p, addr6, sizeof(addr6))) {
                 snprintf(err_msg, sizeof(err_msg),
                          "inet_ntop failed : %s", strerror(errno));
-                error_set(errp, QERR_QGA_COMMAND_FAILED, err_msg);
+                error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg);
                 goto error;
             }
 
@@ -939,22 +937,22 @@ error:
 
 void qmp_guest_suspend_disk(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 void qmp_guest_suspend_ram(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 void qmp_guest_suspend_hybrid(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
 {
-    error_set(errp, QERR_UNSUPPORTED);
+    error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return NULL;
 }
 
@@ -964,21 +962,21 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
 
 GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 
     return 0;
 }
 
 int64_t qmp_guest_fsfreeze_freeze(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 
     return 0;
 }
 
 int64_t qmp_guest_fsfreeze_thaw(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 
     return 0;
 }
@@ -987,7 +985,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
 #if !defined(CONFIG_FSTRIM)
 void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 
     return;
 }
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 54bc546..d5bd012 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -36,8 +36,7 @@ static void acquire_privilege(const char *name, Error **err)
         TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token))
     {
         if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
-            error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                      "no luid for requested privilege");
+            error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "no luid for requested privilege");
             goto out;
         }
 
@@ -45,15 +44,13 @@ static void acquire_privilege(const char *name, Error **err)
         priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
 
         if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {
-            error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                      "unable to acquire requested privilege");
+            error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "unable to acquire requested privilege");
             goto out;
         }
 
         CloseHandle(token);
     } else {
-        error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                  "failed to open privilege token");
+        error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to open privilege token");
     }
 
 out:
@@ -71,8 +68,7 @@ static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, Error **e
     }
     HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL);
     if (!thread) {
-        error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                  "failed to dispatch asynchronous command");
+        error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to dispatch asynchronous command");
         error_propagate(err, local_err);
     }
 }
@@ -90,8 +86,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
     } else if (strcmp(mode, "reboot") == 0) {
         shutdown_flag |= EWX_REBOOT;
     } else {
-        error_set(err, QERR_INVALID_PARAMETER_VALUE, "mode",
-                  "halt|powerdown|reboot");
+        error_set(err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot");
         return;
     }
 
@@ -104,45 +99,45 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
 
     if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) {
         slog("guest-shutdown failed: %d", GetLastError());
-        error_set(err, QERR_UNDEFINED_ERROR);
+        error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
     }
 }
 
 int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
 void qmp_guest_file_close(int64_t handle, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
                                    int64_t count, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
 GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,
                                      bool has_count, int64_t count, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
 GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,
                                    int64_t whence, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
 void qmp_guest_file_flush(int64_t handle, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 /*
@@ -150,7 +145,7 @@ void qmp_guest_file_flush(int64_t handle, Error **err)
  */
 GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
@@ -160,7 +155,7 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err)
  */
 int64_t qmp_guest_fsfreeze_freeze(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
@@ -169,7 +164,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
  */
 int64_t qmp_guest_fsfreeze_thaw(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return 0;
 }
 
@@ -179,7 +174,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
  */
 void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 
     return;
 }
@@ -199,27 +194,23 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **err)
     }
     ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps));
     if (!GetPwrCapabilities(&sys_pwr_caps)) {
-        error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                  "failed to determine guest suspend capabilities");
+        error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to determine guest suspend capabilities");
         goto out;
     }
 
     switch (mode) {
     case GUEST_SUSPEND_MODE_DISK:
         if (!sys_pwr_caps.SystemS4) {
-            error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                      "suspend-to-disk not supported by OS");
+            error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "suspend-to-disk not supported by OS");
         }
         break;
     case GUEST_SUSPEND_MODE_RAM:
         if (!sys_pwr_caps.SystemS3) {
-            error_set(&local_err, QERR_QGA_COMMAND_FAILED,
-                      "suspend-to-ram not supported by OS");
+            error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "suspend-to-ram not supported by OS");
         }
         break;
     default:
-        error_set(&local_err, QERR_INVALID_PARAMETER_VALUE, "mode",
-                  "GuestSuspendMode");
+        error_set(&local_err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "GuestSuspendMode");
     }
 
 out:
@@ -271,12 +262,12 @@ void qmp_guest_suspend_ram(Error **err)
 
 void qmp_guest_suspend_hybrid(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
 }
 
 GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err)
 {
-    error_set(err, QERR_UNSUPPORTED);
+    error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported");
     return NULL;
 }
 
diff --git a/qmp.c b/qmp.c
index fee9fb2..562706f 100644
--- a/qmp.c
+++ b/qmp.c
@@ -108,7 +108,7 @@ void qmp_cpu(int64_t index, Error **errp)
    defined in the VNC subsystem */
 VncInfo *qmp_query_vnc(Error **errp)
 {
-    error_set(errp, QERR_FEATURE_DISABLED, "vnc");
+    error_set(errp, /* QERR_FEATURE_DISABLED */ 27, "The feature 'name=%s' is not enabled", "vnc");
     return NULL;
 };
 #endif
@@ -120,7 +120,7 @@ VncInfo *qmp_query_vnc(Error **errp)
    to be available in the namespace if SPICE is not compiled in */
 SpiceInfo *qmp_query_spice(Error **errp)
 {
-    error_set(errp, QERR_COMMAND_NOT_FOUND, "query-spice");
+    error_set(errp, /* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", "query-spice");
     return NULL;
 };
 #endif
@@ -135,8 +135,7 @@ static void encrypted_bdrv_it(void *opaque, BlockDriverState *bs)
     Error **err = opaque;
 
     if (!error_is_set(err) && bdrv_key_required(bs)) {
-        error_set(err, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs),
-                  bdrv_get_encrypted_filename(bs));
+        error_set(err, /* QERR_DEVICE_ENCRYPTED */ 10, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs));
     }
 }
 
@@ -145,11 +144,11 @@ void qmp_cont(Error **errp)
     Error *local_err = NULL;
 
     if (runstate_check(RUN_STATE_INMIGRATE)) {
-        error_set(errp, QERR_MIGRATION_EXPECTED);
+        error_set(errp, /* QERR_MIGRATION_EXPECTED */ 40, "An incoming migration is expected before this command can be executed");
         return;
     } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
                runstate_check(RUN_STATE_SHUTDOWN)) {
-        error_set(errp, QERR_RESET_REQUIRED);
+        error_set(errp, /* QERR_RESET_REQUIRED */ 58, "Resetting the Virtual Machine is required");
         return;
     } else if (runstate_check(RUN_STATE_SUSPENDED)) {
         return;
@@ -179,7 +178,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
 
     obj = object_resolve_path(path, &ambiguous);
     if (obj == NULL) {
-        error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+        error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path);
         return NULL;
     }
 
@@ -208,7 +207,7 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret)
 
     obj = object_resolve_path(path, NULL);
     if (!obj) {
-        error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
+        error_set(&local_err, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path);
         goto out;
     }
 
@@ -233,7 +232,7 @@ int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret)
 
     obj = object_resolve_path(path, NULL);
     if (!obj) {
-        error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
+        error_set(&local_err, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path);
         goto out;
     }
 
@@ -264,7 +263,7 @@ void qmp_set_password(const char *protocol, const char *password,
         } else if (strcmp(connected, "keep") == 0) {
             /* nothing */
         } else {
-            error_set(errp, QERR_INVALID_PARAMETER, "connected");
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "connected");
             return;
         }
     }
@@ -272,13 +271,13 @@ void qmp_set_password(const char *protocol, const char *password,
     if (strcmp(protocol, "spice") == 0) {
         if (!using_spice) {
             /* correct one? spice isn't a device ,,, */
-            error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+            error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice");
             return;
         }
         rc = qemu_spice_set_passwd(password, fail_if_connected,
                                    disconnect_if_connected);
         if (rc != 0) {
-            error_set(errp, QERR_SET_PASSWD_FAILED);
+            error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password");
         }
         return;
     }
@@ -286,19 +285,19 @@ void qmp_set_password(const char *protocol, const char *password,
     if (strcmp(protocol, "vnc") == 0) {
         if (fail_if_connected || disconnect_if_connected) {
             /* vnc supports "connected=keep" only */
-            error_set(errp, QERR_INVALID_PARAMETER, "connected");
+            error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "connected");
             return;
         }
         /* Note that setting an empty password will not disable login through
          * this interface. */
         rc = vnc_display_password(NULL, password);
         if (rc < 0) {
-            error_set(errp, QERR_SET_PASSWD_FAILED);
+            error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password");
         }
         return;
     }
 
-    error_set(errp, QERR_INVALID_PARAMETER, "protocol");
+    error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol");
 }
 
 void qmp_expire_password(const char *protocol, const char *whenstr,
@@ -320,12 +319,12 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
     if (strcmp(protocol, "spice") == 0) {
         if (!using_spice) {
             /* correct one? spice isn't a device ,,, */
-            error_set(errp, QERR_DEVICE_NOT_ACTIVE, "spice");
+            error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice");
             return;
         }
         rc = qemu_spice_set_pw_expire(when);
         if (rc != 0) {
-            error_set(errp, QERR_SET_PASSWD_FAILED);
+            error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password");
         }
         return;
     }
@@ -333,26 +332,26 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
     if (strcmp(protocol, "vnc") == 0) {
         rc = vnc_display_pw_expire(NULL, when);
         if (rc != 0) {
-            error_set(errp, QERR_SET_PASSWD_FAILED);
+            error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password");
         }
         return;
     }
 
-    error_set(errp, QERR_INVALID_PARAMETER, "protocol");
+    error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol");
 }
 
 #ifdef CONFIG_VNC
 void qmp_change_vnc_password(const char *password, Error **errp)
 {
     if (vnc_display_password(NULL, password) < 0) {
-        error_set(errp, QERR_SET_PASSWD_FAILED);
+        error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password");
     }
 }
 
 static void qmp_change_vnc_listen(const char *target, Error **err)
 {
     if (vnc_display_open(NULL, target) < 0) {
-        error_set(err, QERR_VNC_SERVER_FAILED, target);
+        error_set(err, /* QERR_VNC_SERVER_FAILED */ 70, "Could not start VNC server on target=%s", target);
     }
 }
 
@@ -361,7 +360,7 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
 {
     if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) {
         if (!has_arg) {
-            error_set(errp, QERR_MISSING_PARAMETER, "password");
+            error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "password");
         } else {
             qmp_change_vnc_password(arg, errp);
         }
@@ -372,12 +371,12 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
 #else
 void qmp_change_vnc_password(const char *password, Error **errp)
 {
-    error_set(errp, QERR_FEATURE_DISABLED, "vnc");
+    error_set(errp, /* QERR_FEATURE_DISABLED */ 27, "The feature 'name=%s' is not enabled", "vnc");
 }
 static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
                            Error **errp)
 {
-    error_set(errp, QERR_FEATURE_DISABLED, "vnc");
+    error_set(errp, /* QERR_FEATURE_DISABLED */ 27, "The feature 'name=%s' is not enabled", "vnc");
 }
 #endif /* !CONFIG_VNC */
 
diff --git a/qom/object.c b/qom/object.c
index 00bb3b0..21b7dba 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -683,7 +683,7 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         }
     }
 
-    error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name);
+    error_set(errp, /* QERR_PROPERTY_NOT_FOUND */ 47, "Property 'device=%s.property=%s' not found", "", name);
     return NULL;
 }
 
@@ -714,7 +714,7 @@ void object_property_get(Object *obj, Visitor *v, const char *name,
     }
 
     if (!prop->get) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
     } else {
         prop->get(obj, v, prop->opaque, name, errp);
     }
@@ -729,7 +729,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name,
     }
 
     if (!prop->set) {
-        error_set(errp, QERR_PERMISSION_DENIED);
+        error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation");
     } else {
         prop->set(obj, v, prop->opaque, name, errp);
     }
@@ -756,7 +756,7 @@ char *object_property_get_str(Object *obj, const char *name,
     }
     qstring = qobject_to_qstring(ret);
     if (!qstring) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "string");
         retval = NULL;
     } else {
         retval = g_strdup(qstring_get_str(qstring));
@@ -782,7 +782,7 @@ Object *object_property_get_link(Object *obj, const char *name,
     if (str && *str) {
         target = object_resolve_path(str, NULL);
         if (!target) {
-            error_set(errp, QERR_DEVICE_NOT_FOUND, str);
+            error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", str);
         }
     }
 
@@ -811,7 +811,7 @@ bool object_property_get_bool(Object *obj, const char *name,
     }
     qbool = qobject_to_qbool(ret);
     if (!qbool) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "boolean");
         retval = false;
     } else {
         retval = qbool_get_int(qbool);
@@ -842,7 +842,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
     }
     qint = qobject_to_qint(ret);
     if (!qint) {
-        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
+        error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "int");
         retval = -1;
     } else {
         retval = qint_get_int(qint);
@@ -979,16 +979,16 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
         target = object_resolve_path_type(path, target_type, &ambiguous);
 
         if (ambiguous) {
-            error_set(errp, QERR_AMBIGUOUS_PATH, path);
+            error_set(errp, /* QERR_AMBIGUOUS_PATH */ 1, "Path 'path=%s' does not uniquely identify an object", path);
         } else if (target) {
             object_ref(target);
             *child = target;
         } else {
             target = object_resolve_path(path, &ambiguous);
             if (target || ambiguous) {
-                error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
+                error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, target_type);
             } else {
-                error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+                error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path);
             }
         }
         g_free(target_type);
diff --git a/savevm.c b/savevm.c
index a15c163..71ae5a7 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1555,7 +1555,7 @@ bool qemu_savevm_state_blocked(Error **errp)
 
     QTAILQ_FOREACH(se, &savevm_handlers, entry) {
         if (se->no_migrate) {
-            error_set(errp, QERR_MIGRATION_NOT_SUPPORTED, se->idstr);
+            error_set(errp, /* QERR_MIGRATION_NOT_SUPPORTED */ 41, "State blocked by non-migratable device 'device=%s'", se->idstr);
             return true;
         }
     }
@@ -2182,13 +2182,13 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
 
     f = qemu_fopen(filename, "wb");
     if (!f) {
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename);
         goto the_end;
     }
     ret = qemu_save_device_state(f);
     qemu_fclose(f);
     if (ret < 0) {
-        error_set(errp, QERR_IO_ERROR);
+        error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred");
     }
 
  the_end:
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b3bcbac..7da4dfc 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -631,8 +631,7 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
         return;
     }
     if (value < min || value > max) {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
-                  name ? name : "null", value, min, max);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max);
         return;
     }
 
@@ -670,8 +669,7 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
         return;
     }
     if (value < min || value > max) {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
-                  name ? name : "null", value, min, max);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max);
         return;
     }
 
@@ -706,8 +704,7 @@ static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
         return;
     }
     if (value < min || value > max) {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
-                  name ? name : "null", value, min, max);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max);
         return;
     }
 
@@ -772,8 +769,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value,
     int i;
 
     if (strlen(value) != 12) {
-        error_set(errp, QERR_PROPERTY_VALUE_BAD, "",
-                  "vendor", value);
+        error_set(errp, /* QERR_PROPERTY_VALUE_BAD */ 48, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", "", "vendor", value);
         return;
     }
 
@@ -848,8 +844,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
         return;
     }
     if (value < min || value > max) {
-        error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
-                  name ? name : "null", value, min, max);
+        error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max);
         return;
     }
 
diff --git a/ui/vnc.c b/ui/vnc.c
index cf1cae2..c448f09 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -373,7 +373,7 @@ VncInfo *qmp_query_vnc(Error **errp)
 
         if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa,
                         &salen) == -1) {
-            error_set(errp, QERR_UNDEFINED_ERROR);
+            error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
             goto out_error;
         }
 
@@ -381,7 +381,7 @@ VncInfo *qmp_query_vnc(Error **errp)
                         host, sizeof(host),
                         serv, sizeof(serv),
                         NI_NUMERICHOST | NI_NUMERICSERV) < 0) {
-            error_set(errp, QERR_UNDEFINED_ERROR);
+            error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
             goto out_error;
         }
 
