Page MenuHomePhabricator

Unclear exception when patching non-existant revision
Closed, ResolvedPublic

Description

This exception gets thrown when I run arc patch <bad-rev-number>:

$ arc patch D4502
[2015-07-23 17:42:58] ERROR 2: Invalid argument supplied for foreach() at [/Users/abacker/src/phacility/arcanist/src/workflow/ArcanistWorkflow.php:1167]
arcanist(head=master, ref.master=5e4f9a2bf9d2), phutil(head=master, ref.master=aa6cd8f7e5e5)
  #0 ArcanistWorkflow::loadBundleFromConduit(ConduitClient, array) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1156]
  #1 ArcanistWorkflow::loadRevisionBundleFromConduit(ConduitClient, string) called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:384]
  #2 ArcanistPatchWorkflow::run() called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:397]
  #3 ArcanistPatchWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]
Exception
Argument 1 passed to idx() must be of the type array, boolean given, called in /Users/abacker/src/phacility/arcanist/src/workflow/ArcanistWorkflow.php on line 1174 and defined
(Run with `--trace` for a full exception trace.)
49

Event Timeline

staticshock raised the priority of this task from to Needs Triage.
staticshock updated the task description. (Show Details)
staticshock added a project: Arcanist.
staticshock added a subscriber: staticshock.

I spent 3 seconds on this, but the location where the error occurs and the locations where we know which error message to print are somewhat distant from one another so disentangling this will take a bit of work.

chad renamed this task from Invalid argument supplied for foreach() to Unclear exception when patching non-existant revision.Jul 20 2016, 6:55 PM
chad added a subscriber: sascha-egerer.

Just spent some time tracking down what ended up being this issue. I wonder if adding a check in this block to query for the given revision would be sufficient enough to detect this case and return a more sensible error message. I can submit a diff for that if that'd be acceptable

Is it possible this is related to the E argument mentioned in T12071, but for arc clients?

I don't believe this is related to E being set in variables_order.

I'm going to fix this Real Soon, I absolutely Definitely Promise 100% ™ ®. But I'll accept a patch from a reputable contributor like @jcox any day.