diff --git a/irdb-libs/libIRDB-core/src/assemblestr.hpp b/irdb-libs/libIRDB-core/src/assemblestr.hpp
index dcdc4dfe67df08362b0450ceb34d8f95e16cd963..d23bab993e807548478501e2d4d281165f6deaad 100644
--- a/irdb-libs/libIRDB-core/src/assemblestr.hpp
+++ b/irdb-libs/libIRDB-core/src/assemblestr.hpp
@@ -9,10 +9,9 @@ static void assemblestr(ks_engine * &ks, IRDB_SDK::Instruction_t *ins, const cha
             auto error = ks_errno(ks);
             ks_free((unsigned char*)encode);
                 ks_close(ks);
-                char msg[250];
-                snprintf(msg, sizeof msg,
-                         "ERROR: ks_asm() failed during instruction assembly. (instruction=%s, count=%zu, error=%s)",
-                         instruct, count, ks_strerror(error));
+                auto msg =
+                        string("ERROR: ks_asm() failed during instruction assembly. (instruction='") +
+                        instruct + "', count=" + to_string(count) + ", error='" + ks_strerror(error) + "')";
                 throw std::runtime_error(msg);
     }
         else {