diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 8350d3f6ac3ba106477bd07ddab2f11273aceacd..0b29666f8310b99668dd99e6b81fc41ae73d5bb7 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -3347,11 +3347,12 @@ extern int job_allocate(job_desc_msg_t * job_specs, int immediate,
 	if (error_code) {
 		if (job_ptr && (immediate || will_run)) {
 			/* this should never really happen here */
-			job_ptr->job_state = JOB_PENDING;
+			job_ptr->job_state = JOB_FAILED;
+			job_ptr->exit_code = 1;
 			job_ptr->state_reason = FAIL_BAD_CONSTRAINTS;
 			xfree(job_ptr->state_desc);
 			job_ptr->start_time = job_ptr->end_time = now;
-			job_ptr->priority = 0;
+			job_completion_logger(job_ptr, false);
 		}
 		return error_code;
 	}
@@ -3401,11 +3402,12 @@ extern int job_allocate(job_desc_msg_t * job_specs, int immediate,
 		top_prio = true;	/* don't bother testing,
 					 * it is not runable anyway */
 	if (immediate && (too_fragmented || (!top_prio) || (!independent))) {
-		job_ptr->job_state  = JOB_PENDING;
+		job_ptr->job_state  = JOB_FAILED;
+		job_ptr->exit_code  = 1;
 		job_ptr->state_reason = FAIL_BAD_CONSTRAINTS;
 		xfree(job_ptr->state_desc);
 		job_ptr->start_time = job_ptr->end_time = now;
-		job_ptr->priority = 0;
+		job_completion_logger(job_ptr, false);
 		if (!independent)
 			return ESLURM_DEPENDENCY;
 		else if (too_fragmented)
@@ -3449,11 +3451,12 @@ extern int job_allocate(job_desc_msg_t * job_specs, int immediate,
 	    (error_code == ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE)) {
 		/* Not fatal error, but job can't be scheduled right now */
 		if (immediate) {
-			job_ptr->job_state  = JOB_PENDING;
+			job_ptr->job_state  = JOB_FAILED;
+			job_ptr->exit_code  = 1;
 			job_ptr->state_reason = FAIL_BAD_CONSTRAINTS;
 			xfree(job_ptr->state_desc);
 			job_ptr->start_time = job_ptr->end_time = now;
-			job_ptr->priority = 0;
+			job_completion_logger(job_ptr, false);
 		} else {	/* job remains queued */
 			_create_job_array(job_ptr, job_specs);
 			if ((error_code == ESLURM_NODES_BUSY) ||
@@ -3465,11 +3468,12 @@ extern int job_allocate(job_desc_msg_t * job_specs, int immediate,
 	}
 
 	if (error_code) {	/* fundamental flaw in job request */
-		job_ptr->job_state  = JOB_PENDING;
+		job_ptr->job_state  = JOB_FAILED;
+		job_ptr->exit_code  = 1;
 		job_ptr->state_reason = FAIL_BAD_CONSTRAINTS;
 		xfree(job_ptr->state_desc);
 		job_ptr->start_time = job_ptr->end_time = now;
-		job_ptr->priority = 0;
+		job_completion_logger(job_ptr, false);
 		return error_code;
 	}