phacility/phabricator · error · ConduitException

ERR_BAD_TASK

ERR_BAD_TASK

Error message

ERR_BAD_TASK

What it means

The Conduit method maniphest.info loads the task with ManiphestTaskQuery->withIDs(array($task_id)) as the requesting user; when the query returns no row it throws ConduitException with code ERR_BAD_TASK. That means no task with that numeric ID exists, or the task exists but is not visible to the user owning the Conduit credential.

Source

Thrown at src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php:49

  }

  protected function defineErrorTypes() {
    return array(
      'ERR_BAD_TASK' => pht('No such Maniphest task exists.'),
    );
  }

  protected function execute(ConduitAPIRequest $request) {
    $task_id = $request->getValue('task_id');

    $task = id(new ManiphestTaskQuery())
      ->setViewer($request->getUser())
      ->withIDs(array($task_id))
      ->needSubscriberPHIDs(true)
      ->needProjectPHIDs(true)
      ->executeOne();
    if (!$task) {
      throw new ConduitException('ERR_BAD_TASK');
    }

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

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass the numeric ID without the 'T' prefix (task_id: 123, not 'T123').
  2. Check visibility: call maniphest.query with the same credentials and ids to see whether the task is visible at all.
  3. If the task was deleted, stop retrying and fix the upstream ID source.

Example fix

// before
$result = $conduit->callMethodSynchronous(
  'maniphest.info',
  array('task_id' => 'T123'));
// after
$result = $conduit->callMethodSynchronous(
  'maniphest.info',
  array('task_id' => 123));
Defensive patterns

Strategy: try-catch

Validate before calling

// Check visibility/existence first with the same credentials:
$tasks = id(new ManiphestTaskQuery())
  ->setViewer($viewer)
  ->withIDs(array((int)$task_id))
  ->execute();
if (!$tasks) {
  // do not call maniphest.info with this id
  return null;
}

Type guard

function maniphestTaskVisible($viewer, $task_id) {
  return (bool)id(new ManiphestTaskQuery())
    ->setViewer($viewer)
    ->withIDs(array((int)$task_id))
    ->execute();
}

Try / catch

try {
  $info = $conduit->callMethodSynchronous(
    'maniphest.info',
    array('task_id' => (int)$task_id));
} catch (ConduitException $ex) {
  if ($ex->getErrorCode() === 'ERR_BAD_TASK') {
    // nonexistent or invisible task: skip, do not retry
    $info = null;
  } else {
    throw $ex;
  }
}

Prevention

When it happens

Trigger: Calling maniphest.info with task_id 999999 (nonexistent), passing the monogram 'T123' where withIDs() expects the bare numeric ID, or querying a task whose policies exclude the API token's user.

Common situations: Scripts that paste 'T123' instead of 123; tasks deleted between fetch and detail call; using a bot token that lacks access to the project the task is in.

Related errors


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