Custom Selector error unique 'id' property

Enonic version: 6.15.5
OS: Windows

Hi guys,

We are having an intermittent problem with a custom selector:

We can confirm that our list of “id” is unique, and that error sometimes happen and sometimes not happens, did you have reported some bug like this?

Hi, we had a similar complaint recently and the reason was that developer returned hits object inside of the hits object in the response body.

This is how response should be structured:

body = {
  total: number,
  count: number,
  hits: [{
   id: 1,
   displayName: ...,
   description: ....
  }, {
   id: 2,
   displayName: ...,
   description: ....
  }]
}

Can you verify response from the selector’s service? Post it here maybe.

Hi Alan

Thats a piece of the return:

{
“hits”: [
{
“id”: “ICD10.Y906”,
“displayName”: “Y906 - Påvist alkoholmengde 120-199mg/100ml (1.20-1.99 promille)”,
“description”: “ICD10”
},
{
“id”: “ICD10.D519”,
“displayName”: “D519 - Uspesifisert anemi ved B12-vitaminmangel”,
“description”: “ICD10”
},
{
“id”: “ICD10.D518”,
“displayName”: “D518 - Annen anemi ved B12-vitaminmangel”,
“description”: “ICD10”
},
{
“id”: “ICD10.D513”,
“displayName”: “D513 - Annen diettbetinget anemi med B12-vitaminmangel”,
“description”: “ICD10”
},
{
“id”: “ICD10.D511”,
“displayName”: “D511 - Anemi ved B12-vitaminmangel som skyldes selektiv B12-malabsorpsjon med proteinuri”,
“description”: “ICD10”
},
{
“id”: “ICD10.D510”,
“displayName”: “D510 - Anemi ved B12-vitaminmangel som skyldes mangel på «intrinsic factor»”,
“description”: “ICD10”
},
{
“id”: “ICPC2.B81”,
“displayName”: “B81 - Anemi ved vitamin B12-/folsyremangel”,
“description”: “ICPC2”
}
],
“total”: 7,
“count”: 7
}

ps. all total data (without filter has around 20.000 itens)

Any news about this bug? I have a similar issue in my project.
I have a custom selector that consumes a API, and sometimes this errors appears.
This is an example of response:

{
  hits: [
    {
      "id": "79890006",
      "displayName": "Anorexia",
      "description": "Loss of appetite (finding)"
    },
    {
      "id": "81492003",
      "displayName": "Mood anorexia",
      "description": "Mood anorexia (finding)"
    },
    {
      "id": "56882008",
      "displayName": "Anorexia nervosa",
      "description": "Anorexia nervosa (disorder)"
    },
    {
      "id": "249468005",
      "displayName": "Anorexia symptom",
      "description": "Anorexia symptom (finding)"
    },
    {
      "id": "371141007",
      "displayName": "Anorexiant agent",
      "description": "Medicinal product acting as anorexiant agent (product)"
    }
  ],
  total: 5,
  count: 5
}

Check if your custom selector service receives several concurrent identical requests. We had some enquiries about the same error and every time it turned out there was some duplicate request to blame.

Just add some logging to your method returning data and then check the logs when you get the error.