{"record":{"id":"2889e3fa9b8b8487","repo":"SonarSource/sonarqube","slug":"unable-to-parse-version-numbers-for-major-minor-co","errorCode":null,"errorMessage":"Unable to parse version numbers for major/minor comparison: old='{}', new='{}'","messagePattern":"Unable to parse version numbers for major/minor comparison: old='(.+?)', new='(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-webserver-core/src/main/java/org/sonar/server/startup/IssueFlagResetSetupTask.java","lineNumber":102,"sourceCode":"        resetFromSonarQubeUpdateFlag();\n      }\n    } catch (Exception e) {\n      LOGGER.warn(\"Unable to parse stored version '{}', updating to current version '{}'\", \n        currentVersion.get(), runtimeVersionString, e);\n      updateCurrentVersion(runtimeVersionString);\n    }\n  }\n\n  private static boolean isMajorOrMinorVersionChange(Version newVersion, Version oldVersion) {\n    try {\n      int newMajor = newVersion.major();\n      int newMinor = newVersion.minor();\n      int oldMajor = oldVersion.major();\n      int oldMinor = oldVersion.minor();\n      \n      return newMajor != oldMajor || newMinor != oldMinor;\n    } catch (Exception e) {\n      LOGGER.warn(\"Unable to parse version numbers for major/minor comparison: old='{}', new='{}'\", oldVersion, newVersion, e);\n      return false;\n    }\n  }\n\n  private void updateCurrentVersion(String currentVersion) {\n    internalProperties.write(SONARQUBE_CURRENT_VERSION, currentVersion);\n  }\n\n  private void resetFromSonarQubeUpdateFlag() {\n    try (DbSession dbSession = dbClient.openSession(false)) {\n      int updatedRows = dbClient.issueDao().resetFlagFromSonarQubeUpdate(dbSession);\n      dbSession.commit();\n      LOGGER.info(\"Reset FROM_SONARQUBE_UPDATE flag to false for {} issues\", updatedRows);\n    }\n  }\n\n\n  @Override","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/IssueFlagResetSetupTask.java#L84-L120","documentation":"The helper isMajorOrMinorVersionChange extracts major/minor components of two versions to decide if a flag reset is needed. If accessing version components fails unexpectedly, it logs this warning with both versions and conservatively returns false (no reset), so a version change would be missed this run.","triggerScenarios":"isMajorOrMinorVersionChange (invoked from start) throwing while reading major()/minor() of old/new Version objects — defensive catch for any parsing/extraction failure in the comparison path.","commonSituations":"Malformed stored version strings slipping past earlier parsing; unusual version formats from snapshots or dev builds; corrupted internal property values.","solutions":["Check both logged version strings; correct the stored SONARQUBE_CURRENT_VERSION property to a valid x.y.z version if it is malformed.","If a reset was expected but skipped, manually set the stored version to a matching major/minor and restart so the comparison succeeds.","Restart after fixing to let the task re-evaluate the version change.","Report as a bug if versions are clearly valid yet parsing still fails."],"exampleFix":"-- before: malformed stored version prevents comparison\ninternal_properties: SONARQUBE_CURRENT_VERSION = 'abc'\n-- after: valid version string\ninternal_properties: SONARQUBE_CURRENT_VERSION = '10.4.0'","handlingStrategy":"fallback","validationCode":"function majorMinor(v) {\n  const m = /^(\\d+)\\.(\\d+)/.exec(String(v));\n  return m ? { major: +m[1], minor: +m[2] } : null;\n}","typeGuard":"function hasMajorMinor(v) {\n  return v != null && Number.isInteger(v.major) && Number.isInteger(v.minor);\n}","tryCatchPattern":"try {\n  return compareMajorMinor(oldV, newV);\n} catch (e) {\n  logger.warn('Unable to parse version numbers for comparison', e);\n  return false; // conservative: skip reset\n}","preventionTips":["Keep stored version properties in strict x.y.z format","Fix the SONARQUBE_CURRENT_VERSION property if warnings repeat","Restart after correcting the property so the reset comparison runs","Treat repeated parse warnings as a data-corruption signal"],"tags":["version-parsing","comparison","startup","defensive"],"backgroundTag":"invalid-argument-format","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"}