TheHive-Project / TheHive-Project/Cortex

Cortex "Error: version conflict, document already exists"

Open
#236 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.6k
Forks
264
PR merge metrics
No merged PRs in 30d

Description

Work Environment
Question Answer
OS version (server) Ubuntu
OS version (client) 10
Cortex version / git hash Fresh install from DEB
Package Type DEB
Browser type & version Firefox
Problem Description

After updating database in Cortex, when the create administrator account pages comes up, nothing happens when I press create after filling up the credentials. I tried refreshing the page but then "Error: user init not found" comes up. The logs show that there is a version conflict, document already exists so tried deleting the Cortex instance and elasticsearch to re-initiate Cortex but still unable to create administrator account. Also tried starting over from the very beginning by installing everything again but still facing the same issue.

Had done this before and everything was working fine until recently.

Steps to Reproduce
  1. Install the new instance of Cortex and ElasticSearch
Complementary information

2019-12-03 06:09:34,717 [INFO] from org.thp.cortex.services.ErrorHandler in application-akka.actor.default-dispatcher-5 - POST /api/user returned 400
org.elastic4play.ConflictError: [doc][cortex]: version conflict, document already exists (current version [1])
at org.elastic4play.database.DBConfiguration.$anonfun$execute$2(DBConfiguration.scala:146)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the POST /api/user failure and the stack trace location in DBConfiguration.scala:146, then reproduce the fresh Cortex and Elasticsearch installation described in the issue. Trace why the cortex document already exists during administrator creation; done means the administrator account can be created without the version-conflict or subsequent “user init not found” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, scala
Domain
api, backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.