#1698·conductor

Rerun fails with task_index.workflow_type NOT NULL violation when the workflow contains a SKIPPED task

Author: cburattoCreated Sep 29, 2026Updated Sep 29, 2026

Describe the bug

After a task has been skipped with PUT /api/workflow/{id}/skiptask/{ref}, rerunning the workflow (POST /api/workflow/{id}/rerun) fails with HTTP 500 Error updating task: … in workflow: …. The server log shows the cause:

NonTransientException: ERROR: null value in column "workflow_type" of relation "task_index" violates not-null constraint
  Detail: Failing row contains (<taskId>, t2, t2, SKIPPED, 1970-01-01 00:00:00+00, …, null, …)

(SQLite reports the same thing: [SQLITE_CONSTRAINT_NOTNULL] NOT NULL constraint failed: task_index.workflow_type.)

Root cause

WorkflowExecutorOps#skipTaskFromWorkflow builds the SKIPPED TaskModel by hand and never sets workflowType (nor taskDefName, workflowTask or scheduledTime). A task scheduled by the decider gets all four from TaskMapperContext#createTaskModel. The skip itself succeeds because the index row is not written at that point. During a rerun the task is updated, PostgresIndexDAO / SqliteIndexDAO write task.getWorkflowType() into task_index.workflow_type (NOT NULL), and the update fails.

Details

  • Conductor version: 3.4.0 (conductoross/conductor:3.4.0); the code is unchanged on main at f421832
  • Persistence implementation: Postgres (conductor.db.type=postgres, conductor.indexing.type=postgres) and the default standalone SQLite; both fail
  • Queue implementation: Postgres / SQLite
  • Lock: none (single node)

To Reproduce

Against a stock server (CONDUCTOR=http://localhost:8080):

  1. Register two SIMPLE tasks t1 → t2 in one workflow and start it.
  2. Skip t2 while t1 is still scheduled: PUT /api/workflow/{id}/skiptask/t2.
  3. Poll and complete t1. The workflow completes, with t2 SKIPPED.
  4. POST /api/workflow/{id}/rerun with reRunFromTaskId = t1's task id. This returns HTTP 500.

Code to reproduce (curl only):

bash
#!/usr/bin/env bash
# Reproduces: rerunning a workflow that contains a SKIPPED task fails with a NOT NULL violation on task_index.workflow_type.
# Stock Conductor OSS 3.4.0 (standalone SQLite or Postgres persistence). Usage: CONDUCTOR=http://localhost:8080 ./conductor-skip-rerun-repro.sh
set -euo pipefail
C=${CONDUCTOR:-http://localhost:8080}/api; J='content-type: application/json'
curl -sf -X POST "$C/metadata/taskdefs" -H "$J" -d '[{"name":"repro_t1","retryCount":0,"ownerEmail":"[email protected]"},{"name":"repro_t2","retryCount":0,"ownerEmail":"[email protected]"}]' >/dev/null
curl -sf -X PUT "$C/metadata/workflow" -H "$J" -d '[{"name":"repro_skip_rerun","version":1,"schemaVersion":2,"ownerEmail":"[email protected]","tasks":[{"name":"repro_t1","taskReferenceName":"t1","type":"SIMPLE"},{"name":"repro_t2","taskReferenceName":"t2","type":"SIMPLE"}]}]' >/dev/null
WF=$(curl -sf -X POST "$C/workflow/repro_skip_rerun?version=1" -H "$J" -d '{}'); echo "workflow $WF"
curl -sf -X PUT "$C/workflow/$WF/skiptask/t2" -H "$J" -d '{}' >/dev/null; echo "skipped t2 (not yet reached)"
T=""; for i in $(seq 1 20); do T=$(curl -sf "$C/tasks/poll/repro_t1?workerid=repro" || true); [ -n "$T" ] && break; sleep 0.5; done
TID=$(echo "$T" | sed -E 's/.*"taskId":"([^"]+)".*/\1/')
curl -sf -X POST "$C/tasks" -H "$J" -d "{\"workflowInstanceId\":\"$WF\",\"taskId\":\"$TID\",\"status\":\"COMPLETED\",\"outputData\":{}}" >/dev/null; sleep 1
echo "status after t1: $(curl -sf "$C/workflow/$WF" | sed -E 's/.*"status":"([A-Z_]+)".*/\1/' | head -c 20)"
echo "rerun from t1:"; curl -s -w "\nHTTP %{http_code}\n" -X POST "$C/workflow/$WF/rerun" -H "$J" -d "{\"reRunFromWorkflowId\":\"$WF\",\"reRunFromTaskId\":\"$TID\"}"

Output on a stock server:

skipped t2 (not yet reached)
status after t1: COMPLETED
rerun from t1:
{"status":500,"message":"Error updating task: … in workflow: …","retryable":true}
HTTP 500

Expected behavior

The rerun succeeds and the workflow runs again from t1, as it does for a workflow without a skipped task.

Proposed fix (happy to open a PR once the approach is agreed, per CONTRIBUTING)

In skipTaskFromWorkflow, give the skipped task the same identity a scheduled task carries:

java
taskToBeSkipped.setWorkflowType(workflow.getWorkflowName());
taskToBeSkipped.setTaskDefName(workflowTask.getName());
taskToBeSkipped.setWorkflowTask(workflowTask);
taskToBeSkipped.setScheduledTime(System.currentTimeMillis());

A unit test in TestWorkflowExecutor (testSkipTaskFromWorkflowPopulatesTaskIdentity) captures the task passed to createTasks and asserts these fields. It fails without the fix and passes with it, and the whole TestWorkflowExecutor class (61 tests) passes with the fix.

Workflows skipped before the fix still hold tasks without workflowType. If that matters, the index DAOs could fall back to the parent workflow's name. We left that out of the minimal change and are happy to add it if preferred.