title: Neo4j - Community - 4.0.2 - Database won't start (Internal token for id 9 not found, but a public token exists on that id)
body: <p>Issue: We had a working Neo4j instance running on an AWS EC2 instance. By mistake, it was stopped accidentally. Now the database is not coming back.</p>
  <p>What we tried so far:</p>
  <ol>
  <li>Build a brand new machine and try to restore and load data from the existing Neo4j instances. I used the neo4j-admin utility to do so. Restarted the database but no luck.</li>
  </ol>
  <p>Version Details:
  Neo4.j - 4.0.2 Community</p>
  <p>PlatformType&quot;: &quot;Linux&quot;,
  PlatformVersion&quot;: &quot;16.04&quot;,
  PlatformName&quot;: &quot;Ubuntu&quot;,
  ResourceType&quot;: &quot;EC2Instance&quot;,</p>
  <p>Debug.log shows below-mentioned error.</p>
  <pre><code>2022-08-25 17:29:52.159+0000 INFO [o.n.i.d.DiagnosticsManager] 
  2022-08-25 17:29:52.209+0000 WARN [o.n.k.d.Database] [neo4j] Exception occurred while starting the database. Trying to stop already started components. Component 'org.neo4j.internal.recordstorage.RecordStorageEngine$2@668d9b0' failed to initialize. Please see the attached cause exception &quot;Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].&quot;.
  org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.internal.recordstorage.RecordStorageEngine$2@668d9b0' failed to initialize. Please see the attached cause exception &quot;Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].&quot;.
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:426)
      at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:66)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:102)
      at org.neo4j.kernel.database.Database.start(Database.java:462)
      at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:187)
      at org.neo4j.dbms.database.DefaultDatabaseManager.startDatabase(DefaultDatabaseManager.java:132)
      at org.neo4j.dbms.database.DefaultDatabaseManager.initialiseDefaultDatabase(DefaultDatabaseManager.java:64)
      at org.neo4j.dbms.database.DefaultDatabaseInitializer.start0(DefaultDatabaseInitializer.java:39)
      at org.neo4j.kernel.lifecycle.SafeLifecycle.transition(SafeLifecycle.java:124)
      at org.neo4j.kernel.lifecycle.SafeLifecycle.start(SafeLifecycle.java:138)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
      at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:158)
      at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:145)
      at org.neo4j.server.database.CommunityGraphFactory.newDatabaseManagementService(CommunityGraphFactory.java:36)
      at org.neo4j.server.database.LifecycleManagingDatabaseService.start(LifecycleManagingDatabaseService.java:88)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
      at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:157)
      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:114)
      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:89)
      at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:35)
  Caused by: java.lang.RuntimeException: org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException: Cannot read schema rule because it is referring to a property key token (id 9) that does not exist.
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRuleThrowingRuntimeException(SchemaStorage.java:272)
      at org.neo4j.internal.recordstorage.SchemaStorage.lambda$streamAllSchemaRules$5(SchemaStorage.java:244)
      at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      at java.base/java.util.stream.LongPipeline$1$1.accept(LongPipeline.java:177)
      at java.base/java.util.stream.Streams$RangeLongSpliterator.tryAdvance(Streams.java:207)
      at java.base/java.util.Spliterator$OfLong.tryAdvance(Spliterator.java:740)
      at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
      at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
      at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
      at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
      at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
      at org.neo4j.internal.recordstorage.SchemaCache$SchemaCacheState.load(SchemaCache.java:298)
      at org.neo4j.internal.recordstorage.SchemaCache$SchemaCacheState.&lt;init&gt;(SchemaCache.java:264)
      at org.neo4j.internal.recordstorage.SchemaCache.load(SchemaCache.java:134)
      at org.neo4j.internal.recordstorage.RecordStorageEngine.loadSchemaCache(RecordStorageEngine.java:368)
      at org.neo4j.internal.recordstorage.RecordStorageEngine$2.init(RecordStorageEngine.java:459)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:405)
      ... 21 more
  Caused by: org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException: Cannot read schema rule because it is referring to a property key token (id 9) that does not exist.
      at org.neo4j.kernel.impl.store.SchemaStore.insertPropertyIntoMap(SchemaStore.java:463)
      at org.neo4j.kernel.impl.store.SchemaStore.schemaRecordToMap(SchemaStore.java:445)
      at org.neo4j.kernel.impl.store.SchemaStore.readSchemaRule(SchemaStore.java:326)
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRule(SchemaStorage.java:280)
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRuleThrowingRuntimeException(SchemaStorage.java:265)
      ... 38 more
  Caused by: org.neo4j.token.api.TokenNotFoundException: Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].
      at org.neo4j.token.AbstractTokenHolderBase.getInternalTokenById(AbstractTokenHolderBase.java:121)
      at org.neo4j.kernel.impl.store.SchemaStore.insertPropertyIntoMap(SchemaStore.java:457)
      ... 42 more
  2022-08-25 17:29:52.211+0000 ERROR [o.n.d.d.DefaultDatabaseManager] Failed to start database: neo4j An error occurred! Unable to start database with name `neo4j`.
  org.neo4j.dbms.api.DatabaseManagementException: An error occurred! Unable to start database with name `neo4j`.
      at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:191)
      at org.neo4j.dbms.database.DefaultDatabaseManager.startDatabase(DefaultDatabaseManager.java:132)
      at org.neo4j.dbms.database.DefaultDatabaseManager.initialiseDefaultDatabase(DefaultDatabaseManager.java:64)
      at org.neo4j.dbms.database.DefaultDatabaseInitializer.start0(DefaultDatabaseInitializer.java:39)
      at org.neo4j.kernel.lifecycle.SafeLifecycle.transition(SafeLifecycle.java:124)
      at org.neo4j.kernel.lifecycle.SafeLifecycle.start(SafeLifecycle.java:138)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
      at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(DatabaseManagementServiceFactory.java:158)
      at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:145)
      at org.neo4j.server.database.CommunityGraphFactory.newDatabaseManagementService(CommunityGraphFactory.java:36)
      at org.neo4j.server.database.LifecycleManagingDatabaseService.start(LifecycleManagingDatabaseService.java:88)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:444)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
      at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:157)
      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:114)
      at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:89)
      at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:35)
  Caused by: java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.internal.recordstorage.RecordStorageEngine$2@668d9b0' failed to initialize. Please see the attached cause exception &quot;Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].&quot;.
      at org.neo4j.kernel.database.Database.start(Database.java:478)
      at org.neo4j.dbms.database.AbstractDatabaseManager.startDatabase(AbstractDatabaseManager.java:187)
      ... 17 more
  Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.internal.recordstorage.RecordStorageEngine$2@668d9b0' failed to initialize. Please see the attached cause exception &quot;Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].&quot;.
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:426)
      at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:66)
      at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:102)
      at org.neo4j.kernel.database.Database.start(Database.java:462)
      ... 18 more
  Caused by: java.lang.RuntimeException: org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException: Cannot read schema rule because it is referring to a property key token (id 9) that does not exist.
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRuleThrowingRuntimeException(SchemaStorage.java:272)
      at org.neo4j.internal.recordstorage.SchemaStorage.lambda$streamAllSchemaRules$5(SchemaStorage.java:244)
      at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
      at java.base/java.util.stream.LongPipeline$1$1.accept(LongPipeline.java:177)
      at java.base/java.util.stream.Streams$RangeLongSpliterator.tryAdvance(Streams.java:207)
      at java.base/java.util.Spliterator$OfLong.tryAdvance(Spliterator.java:740)
      at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
      at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
      at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
      at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
      at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
      at org.neo4j.internal.recordstorage.SchemaCache$SchemaCacheState.load(SchemaCache.java:298)
      at org.neo4j.internal.recordstorage.SchemaCache$SchemaCacheState.&lt;init&gt;(SchemaCache.java:264)
      at org.neo4j.internal.recordstorage.SchemaCache.load(SchemaCache.java:134)
      at org.neo4j.internal.recordstorage.RecordStorageEngine.loadSchemaCache(RecordStorageEngine.java:368)
      at org.neo4j.internal.recordstorage.RecordStorageEngine$2.init(RecordStorageEngine.java:459)
      at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:405)
      ... 21 more
  Caused by: org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException: Cannot read schema rule because it is referring to a property key token (id 9) that does not exist.
      at org.neo4j.kernel.impl.store.SchemaStore.insertPropertyIntoMap(SchemaStore.java:463)
      at org.neo4j.kernel.impl.store.SchemaStore.schemaRecordToMap(SchemaStore.java:445)
      at org.neo4j.kernel.impl.store.SchemaStore.readSchemaRule(SchemaStore.java:326)
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRule(SchemaStorage.java:280)
      at org.neo4j.internal.recordstorage.SchemaStorage.readSchemaRuleThrowingRuntimeException(SchemaStorage.java:265)
      ... 38 more
  Caused by: org.neo4j.token.api.TokenNotFoundException: Internal token for id 9 not found, but a public token exists on that id: NamedToken[name:account_id, id:9, internal:false].
      at org.neo4j.token.AbstractTokenHolderBase.getInternalTokenById(AbstractTokenHolderBase.java:121)
      at org.neo4j.kernel.impl.store.SchemaStore.insertPropertyIntoMap(SchemaStore.java:457)
      ... 42 more
  2022-08-25 17:29:52.296+0000 INFO [o.n.b.BoltServer] Bolt enabled on 10.126.9.105:7687.
  2022-08-25 17:29:52.349+0000 INFO [o.n.s.AbstractNeoServer$ServerComponentsLifecycleAdapter] [system] Starting web server
  2022-08-25 17:29:53.740+0000 INFO [o.n.s.AbstractNeoServer$ServerComponentsLifecycleAdapter] [system] Web server started.
  </code></pre>