Page MenuHomePhabricator

Error: "Policy identifier is an object PHID (''), but no object handle was provided. A handle must be provided for object policies."
Open, LowestPublic

Description

A colleague of mine was trying to create a burn-down chart on a sprint (Milestone of a project) in our instance of Phabricator with the Sprint extension, but got the error in the title.

Trying to debug it I extracted the full stack trace in JSON format:

[
 {
    "file":"\/phabricator\/src\/applications\/transactions\/storage\/PhabricatorApplicationTransaction.php",
    "line":409,
    "function":"newFromPolicyAndHandle",
    "class":"PhabricatorPolicy",
    "type":"::",
    "args":[
       null,
       null
    ]
 },
 {
    "file":"\/phabricator\/src\/applications\/transactions\/storage\/PhabricatorApplicationTransaction.php",
    "line":864,
    "function":"renderPolicyName",
    "class":"PhabricatorApplicationTransaction",
    "object":{},
    "type":"->",
    "args":[
       null,
       "old"
    ]
 },
 {
    "file":"\/phabricator\/src\/applications\/maniphest\/storage\/ManiphestTransaction.php",
    "line":638,
    "function":"getTitle",
    "class":"PhabricatorApplicationTransaction",
    "object":{},
    "type":"->",
    "args":[

    ]
 },
 {
    "file":"\/phabricator\/libext\/Sprint\/src\/query\/SprintQuery.php",
    "line":345,
    "function":"getTitle",
    "class":"ManiphestTransaction",
    "object":{},
    "type":"->",
    "args":[

    ]
 },
 {
    "file":"\/phabricator\/libext\/Sprint\/src\/query\/SprintQuery.php",
    "line":272,
    "function":"extractEvents",
    "class":"SprintQuery",
    "object":{},
    "type":"->",
    "args":[
       {
          "32741":{},
          "32740":{},
          "32739":{},
          "32738":{},
          "32737":{},
          "32735":{},
          "32734":{},
          "32733":{},
          "32732":{},
          "32692":{},
          "32691":{},
          "32690":{},
          "32689":{},
          "32688":{},
          "32687":{},
          "32686":{},
          "32685":{},
          "32596":{},
          "32595":{},
          "32594":{},
          "32592":{},
          "32591":{},
          "32590":{},
          "32589":{},
          "32588":{},
          "31037":{},
          "31036":{},
          "31035":{},
          "31034":{},
          "31033":{},
          "31032":{},
          "31031":{},
          "31030":{},
          "31029":{},
          "31028":{},
          "31027":{},
          "31026":{},
          "31025":{},
          "31024":{},
          "31023":{},
          "31022":{},
          "31021":{},
          "31020":{},
          "31019":{},
          "31018":{},
          "31017":{},
          "31016":{},
          "31015":{},
          "31014":{},
          "31013":{},
          "31012":{},
          "31011":{},
          "31010":{},
          "31009":{},
          "31008":{},
          "31007":{},
          "31006":{},
          "31005":{},
          "31004":{},
          "31003":{},
          "31002":{},
          "31001":{},
          "31000":{},
          "30999":{},
          "30998":{},
          "30997":{},
          "30996":{},
          "30995":{},
          "30994":{},
          "30993":{},
          "30992":{},
          "30991":{},
          "30990":{},
          "30989":{}
       }
    ]
 },
 {
    "file":"\/phabricator\/libext\/Sprint\/src\/view\/burndown\/SprintDataView.php",
    "line":157,
    "function":"getEvents",
    "class":"SprintQuery",
    "object":{},
    "type":"->",
    "args":[
       {
          "32741":{},
          "32740":{},
          "32739":{},
          "32738":{},
          "32737":{},
          "32735":{},
          "32734":{},
          "32733":{},
          "32732":{},
          "32692":{},
          "32691":{},
          "32690":{},
          "32689":{},
          "32688":{},
          "32687":{},
          "32686":{},
          "32685":{},
          "32596":{},
          "32595":{},
          "32594":{},
          "32592":{},
          "32591":{},
          "32590":{},
          "32589":{},
          "32588":{},
          "31037":{},
          "31036":{},
          "31035":{},
          "31034":{},
          "31033":{},
          "31032":{},
          "31031":{},
          "31030":{},
          "31029":{},
          "31028":{},
          "31027":{},
          "31026":{},
          "31025":{},
          "31024":{},
          "31023":{},
          "31022":{},
          "31021":{},
          "31020":{},
          "31019":{},
          "31018":{},
          "31017":{},
          "31016":{},
          "31015":{},
          "31014":{},
          "31013":{},
          "31012":{},
          "31011":{},
          "31010":{},
          "31009":{},
          "31008":{},
          "31007":{},
          "31006":{},
          "31005":{},
          "31004":{},
          "31003":{},
          "31002":{},
          "31001":{},
          "31000":{},
          "30999":{},
          "30998":{},
          "30997":{},
          "30996":{},
          "30995":{},
          "30994":{},
          "30993":{},
          "30992":{},
          "30991":{},
          "30990":{},
          "30989":{}
       },
       {
          "PHID-TASK-eoyqd7nyorlygz6ak2ng":{},
          "PHID-TASK-osl7yjongtjgtsiocxw5":{},
          "PHID-TASK-qvyr47paabbcfvyb3l45":{},
          "PHID-TASK-7wkd4y263t46gtlbrkzy":{},
          "PHID-TASK-2tnimknsliru2fnkzz6z":{},
          "PHID-TASK-4im6ok2mnjruytx4rmie":{},
          "PHID-TASK-dcnznoskbglr3vycfdoq":{}
       }
    ]
 },
 {
    "file":"\/phabricator\/libext\/Sprint\/src\/view\/burndown\/SprintDataView.php",
    "line":110,
    "function":"setEvents",
    "class":"SprintDataView",
    "object":{},
    "type":"->",
    "args":[ {} ]
 },
 {
    "file":"\/phabricator\/src\/view\/AphrontView.php",
    "line":222,
    "function":"render",
    "class":"SprintDataView",
    "object":{},
    "type":"->",
    "args":[ ]
 },
 {
    "file":"\/libphutil\/src\/markup\/render.php",
    "line":133,
    "function":"producePhutilSafeHTML",
    "class":"AphrontView",
    "object":{},
    "type":"->",
    "args":[ ]
 },
 {
    "file":"\/libphutil\/src\/markup\/render.php",
    "line":189,
    "function":"phutil_escape_html",
    "args":[ {} ]
 },
 {
    "file":"\/phabricator\/src\/view\/page\/PhabricatorBarePageView.php",
    "line":58,
    "function":"phutil_implode_html",
    "args":[
       "",
       [
          null,
          {}
       ]
    ]
 },
 {
    "file":"\/phabricator\/src\/view\/page\/PhabricatorStandardPageView.php",
    "line":199,
    "function":"willRenderPage",
    "class":"PhabricatorBarePageView",
    "object":{

    },
    "type":"->",
    "args":[ ]
 },
 {
    "file":"\/phabricator\/src\/view\/page\/AphrontPageView.php",
    "line":46,
    "function":"willRenderPage",
    "class":"PhabricatorStandardPageView",
    "object":{},
    "type":"->",
    "args":[

    ]
 },
 {
    "file":"\/phabricator\/src\/view\/page\/PhabricatorStandardPageView.php",
    "line":890,
    "function":"render",
    "class":"AphrontPageView",
    "object":{},
    "type":"->",
    "args":[ ]
 },
 {
    "file":"\/phabricator\/src\/aphront\/configuration\/AphrontApplicationConfiguration.php",
    "line":649,
    "function":"produceAphrontResponse",
    "class":"PhabricatorStandardPageView",
    "object":{},
    "type":"->",
    "args":[ ]
 },
 {
    "file":"\/phabricator\/src\/aphront\/configuration\/AphrontApplicationConfiguration.php",
    "line":278,
    "function":"produceResponse",
    "class":"AphrontApplicationConfiguration",
    "object":{},
    "type":"->",
    "args":[ {}, {} ]
 },
 {
    "file":"\/phabricator\/src\/aphront\/configuration\/AphrontApplicationConfiguration.php",
    "line":181,
    "function":"processRequest",
    "class":"AphrontApplicationConfiguration",
    "object":{

    },
    "type":"->",
    "args":[ {}, {}, {}, {} ]
 },
 {
    "file":"\/phabricator\/webroot\/index.php",
    "line":17,
    "function":"runHTTPRequest",
    "class":"AphrontApplicationConfiguration",
    "type":"::",
    "args":[ {} ]
 }
]

Does the error message or this trace tell something to someone?

I can do more tests or give more data if required.

Thank you!

PS: just to add that the functionality is working properly for other projects/subprojects/milestones

Event Timeline

Steve created this task.Jan 18 2017, 6:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 18 2017, 6:46 PM
Steve updated the task description. (Show Details)Jan 19 2017, 3:40 PM

Please provide version information.

This issue is caused by several poorly written upstream methods: primarily renderPolicyName. The error message is misleading and in fact you can see the real problem which is that there is a null policy creation or edit transaction object (which is why there is no PHID in the message) for one of your tasks.

This type of transaction creates an event that would look like this: 'christopher created this object with visibility "Task Author"' in the Sprint extension events view.

renderPolicyName calls a static method PhabricatorPolicy::newFromPolicyAndHandle that gets two parameters, but both are derived from the same transaction object which is the $phid passed to renderPolicyName. So, if the first parameter is null, then the second parameter is also null. For some odd reason, newFromPolicyAndHandle throws an exception on a null value for the second parameter, but this static method should never be called by renderPolicyName if it has no $phid.

I am sorry to say this, but this is not a Sprint extension issue directly. The Sprint extension does not create Maniphest transactions, it just reads them. Somehow, your phabricator instance created a null policy transaction . This could be for a wide variety of reasons that I would not be able to answer without debugging the terribly complex phabricator policy implementation, which is not something I want to do. I suggest that you file an issue upstream and they may be able to explain it further. To workaround the immediate issue, you could disable the events table in the sprint configuration by setting sprint.show-events-table to false.

Restricted Application added a project: Upstream. · View Herald TranscriptJan 20 2017, 4:53 AM
Restricted Application added a subscriber: TerraCodes. · View Herald Transcript
Steve added a comment.Jan 20 2017, 9:04 AM

@Aklapper : I tryed with an old and a new version and both show the same problem

phabricator
  fe9f16ad0dd0fc991441b5e365a7d764fb12f11f (Sep 9 2016) 
arcanist
  9e82ef979e8148c43b9b8439025d505b1219e213 (Aug 25 2016) 
phutil
  0107c187b6d8a4c1725972ab80a6cdc97d9912d3 (Sep 9 2016) 
sprint
  800a5e776027c974140daaf90383750e2e3b9bb6 (Sep 4 2016)

and

phabricator
  a4a9485612839072a46e715d1ce47c29eddcb134 (Mon, Jan 16) 
arcanist
  ade25facfdf22aed1c1e20fed3e58e60c0be3c2b (Thu, Jan 5) 
phutil
  9d85dfab0f532d50c2343719e92d574a4827341b (Fri, Jan 13) 
sprint
  2bdddf4187407182a9a37e8e1d8789c2f7e1da7e (Wed, Jan 11)

@Christopher : The proposed workaround works, THANK YOU!!! :)

Regarding the tasks, they have been automatically created with Conduit interface (it was a massive 500 task import from an excel)... maybe the problem resides in this? The commands used were something like:

echo '{ "title": "task title", "description": "task description", "viewPolicy": "PHID-PROJ-lvmo7x65sidh5zykerlo", "editPolicy": "PHID-PROJ-lvmo7x65sidh5zykerlo", "ccPHIDs": [ ], "priority": 90, "projectPHIDs": [ "PHID-PROJ-lvmo7x65sidh5zykerlo" ] }' | ~/arcanist/arcanist/bin/arc call-conduit --conduit-uri https://phabricator.internal --conduit-token 'api-xxxxxxxpgh4wzoisbiiwtomsbudv' maniphest.createtask
Peachey88 updated the task description. (Show Details)Jan 20 2017, 9:10 AM
Aklapper triaged this task as Lowest priority.Feb 26 2017, 6:33 PM