{"record":{"id":"a3b2b7498c86623c","repo":"SonarSource/sonarqube","slug":"server-id-is-reset-because-it-is-not-valid-anymore","errorCode":null,"errorMessage":"Server ID is reset because it is not valid anymore. Database URL probably changed. The new server ID affects SonarSource licensed products.","messagePattern":"Server ID is reset because it is not valid anymore\\. Database URL probably changed\\. The new server ID affects SonarSource licensed products\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java","lineNumber":91,"sourceCode":"      }\n    }\n  }\n\n  private ServerId keepOrReplaceCurrentServerId(DbSession dbSession, ServerId currentServerId, Optional<String> checksum) {\n    if (keepServerId(currentServerId, checksum)) {\n      return currentServerId;\n    }\n\n    ServerId serverId = replaceCurrentServerId(currentServerId);\n    persistServerId(dbSession, serverId);\n    return serverId;\n  }\n\n  private boolean keepServerId(ServerId serverId, Optional<String> checksum) {\n    if (checksum.isPresent()) {\n      String expectedChecksum = serverIdChecksum.computeFor(serverId.toString());\n      if (!expectedChecksum.equals(checksum.get())) {\n        LOGGER.warn(\"Server ID is reset because it is not valid anymore. Database URL probably changed. The new server ID affects SonarSource licensed products.\");\n        return false;\n      }\n    }\n\n    // Existing server ID must be kept when upgrading to 6.7+. In that case the checksum does not exist.\n    return true;\n  }\n\n  private ServerId replaceCurrentServerId(ServerId currentServerId) {\n    return serverIdFactory.create(currentServerId);\n  }\n\n  private ServerId createFirstServerId(DbSession dbSession) {\n    ServerId serverId = serverIdFactory.create();\n    persistServerId(dbSession, serverId);\n    return serverId;\n  }\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java#L73-L109","documentation":"ServerIdManager keeps a server ID whose checksum must match a checksum computed from the server ID (which encodes the DB connection URL). When the stored checksum does not match the recomputed one, SonarQube logs this warning and resets (regenerates) the server ID, because the ID is tied to the database URL and its stored validation no longer holds.","triggerScenarios":"Calling keepOrReplaceCurrentServerId -> keepServerId when a checksum is present but serverIdChecksum.computeFor(serverId.toString()) differs from the stored checksum — typically after the database URL changed or the checksum row was tampered with/restored inconsistently.","commonSituations":"Migrating SonarQube to a different database (or restored DB copy from another instance/URL); DB host, port, or schema name changed; copying a production DB into a test environment; manually editing the sonar.server_id / internal property rows.","solutions":["If the DB URL change was intended, accept the reset: note that the new server ID requires re-entering license keys for commercial plugins.","If unintended, restore the original database URL and confirm jdbc url in sonar.properties matches the DB the checksum was generated against.","Re-apply product licenses after the reset (new server ID).","Avoid copying databases between environments without expecting a server-ID reset."],"exampleFix":"// before: sonar.properties pointing to a different DB than the one the server ID was created with\nsonar.jdbc.url=jdbc:postgresql://newdb:5432/sonar\n// after: restore original URL (or accept license re-entry after reset)\nsonar.jdbc.url=jdbc:postgresql://originaldb:5432/sonar","handlingStrategy":"validation","validationCode":"-- verify checksum consistency before upgrade/migration\nSELECT * FROM internal_properties WHERE kee LIKE 'serverId%';\n-- recompute expected checksum from the current JDBC URL and compare","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never point an existing installation at a copied/moved database without expecting a server-ID reset","Keep sonar.jdbc.url stable across restarts and migrations","Back up the internal_properties rows holding the server ID and checksum","Plan for license re-entry whenever the DB URL changes"],"tags":["server-id","database-url","licensing","checksum"],"backgroundTag":"checksum-mismatch","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}