phacility/phabricator · error · ConduitException

ERR-BAD-TASK

ERR-BAD-TASK

Error message

ERR-BAD-TASK

What it means

maniphest.update throws ConduitException 'ERR-BAD-TASK' ('No such Maniphest task exists.') when ManiphestTaskQuery->executeOne() returns nothing for the given id or phid. Because the query runs with the conduit user as viewer, this covers both tasks that do not exist and tasks the acting user cannot see.

Source

Thrown at src/applications/maniphest/conduit/ManiphestUpdateConduitAPIMethod.php:71

      ->needSubscriberPHIDs(true)
      ->needProjectPHIDs(true);
    if ($id) {
      $query->withIDs(array($id));
    } else {
      $query->withPHIDs(array($phid));
    }
    $task = $query->executeOne();

    $params = $request->getAllParameters();
    unset($params['id']);
    unset($params['phid']);

    if (call_user_func_array('coalesce', $params) === null) {
      throw new ConduitException('ERR-NO-EFFECT');
    }

    if (!$task) {
      throw new ConduitException('ERR-BAD-TASK');
    }

    $task = $this->applyRequest($task, $request, $is_new = false);

    return $this->buildTaskInfoDictionary($task);
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Verify the task exists and is visible to the acting user first, e.g. maniphest.query with ids/phids, and inspect what comes back.
  2. If the task exists but is policy-restricted, have an admin grant the bot/conduit user view+edit access (project membership or explicit policy).
  3. Discard stale identifiers: re-resolve ids from a trusted source (task URI T-number or a fresh query) before updating.

Example fix

// before
$conduit->callMethodSynchronous('maniphest.update', array(
  'id' => $cached_id, // deleted or invisible -> ERR-BAD-TASK
  'title' => 'x',
));

// after
$exists = $conduit->callMethodSynchronous('maniphest.query', array(
  'ids' => array($cached_id),
));
if (isset($exists[$cached_id])) {
  $conduit->callMethodSynchronous('maniphest.update', array(
    'id' => $cached_id,
    'title' => 'x',
  ));
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight visibility/existence check
$tasks = $conduit->callMethodSynchronous('maniphest.query', array(
  'ids' => array($id),
));
if (empty($tasks[$id])) {
  // task missing or invisible to this credential; do not attempt update
}

Try / catch

try {
  $result = $conduit->callMethodSynchronous('maniphest.update', $params);
} catch (ConduitClientException $e) {
  if ($e->getMessage() === 'ERR-BAD-TASK') {
    // drop cached identifier, re-resolve, or skip this task
  } else {
    throw $e;
  }
}

Prevention

When it happens

Trigger: Calling maniphest.update with an id that was deleted, a phid from a different object type or typo, or a valid task PHID owned by a project the conduit user has no view permission for. executeOne() returns null and the ERR-BAD-TASK branch fires.

Common situations: Automation retrying updates on tasks closed as duplicates/spam (which may be hidden), stale phids cached from long ago, conduit tokens belonging to a bot user that was never added to the relevant project policy, or test scripts against production ids that do not exist in the test instance.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/74eea4696944ccac. Report an issue: GitHub.