diff --git a/src/engine.c b/src/engine.c
index 5e7aa207f263f0f25bab2fa6eae2794e169451af..d9c9110c283a3497284488db3465273cbde038ba 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -3922,15 +3922,15 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs,
 
 #ifdef SWIFT_DEBUG_CHECKS
   /* Check that we have the correct total mass in the top-level multipoles */
-  size_t num_gpart_mpole = 0;
+  long long num_gpart_mpole = 0;
   if (e->policy & engine_policy_self_gravity) {
     for (int i = 0; i < e->s->nr_cells; ++i)
       num_gpart_mpole += e->s->cells_top[i].multipole->m_pole.num_gpart;
     if (num_gpart_mpole != e->total_nr_gparts)
       error(
           "Top-level multipoles don't contain the total number of gpart "
-          "s->nr_gpart=%zd, "
-          "m_poles=%zd",
+          "s->nr_gpart=%lld, "
+          "m_poles=%lld",
           e->total_nr_gparts, num_gpart_mpole);
   }
 #endif
@@ -4113,14 +4113,14 @@ void engine_step(struct engine *e) {
 
 #ifdef SWIFT_DEBUG_CHECKS
   /* Check that we have the correct total mass in the top-level multipoles */
-  size_t num_gpart_mpole = 0;
+  long long num_gpart_mpole = 0;
   if (e->policy & engine_policy_self_gravity) {
     for (int i = 0; i < e->s->nr_cells; ++i)
       num_gpart_mpole += e->s->cells_top[i].multipole->m_pole.num_gpart;
     if (num_gpart_mpole != e->total_nr_gparts)
       error(
-          "Multipoles don't contain the total number of gpart mpoles=%zd "
-          "ngparts=%zd",
+          "Multipoles don't contain the total number of gpart mpoles=%lld "
+          "ngparts=%lld",
           num_gpart_mpole, e->total_nr_gparts);
   }
 #endif
diff --git a/src/runner.c b/src/runner.c
index 58b9b710cc270f27e057ce404b51fc5d7118dc85..c9d119377b7d753b52ff13eb860f18af800318ca 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1490,7 +1490,7 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) {
                 "g-particle (id=%lld, type=%s) did not interact "
                 "gravitationally "
                 "with all other gparts gp->num_interacted=%lld, "
-                "total_gparts=%zd (local num_gparts=%zd)",
+                "total_gparts=%lld (local num_gparts=%zd)",
                 gp->id_or_neg_offset, part_type_names[gp->type],
                 gp->num_interacted, e->total_nr_gparts, e->s->nr_gparts);
         }