{"record":{"id":"fc6ecc39d4be16f2","repo":"SonarSource/sonarqube","slug":"unable-to-parse-stored-version-updating-to-c","errorCode":null,"errorMessage":"Unable to parse stored version '{}', updating to current version '{}'","messagePattern":"Unable to parse stored version '(.+?)', updating to current version '(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-webserver-core/src/main/java/org/sonar/server/startup/IssueFlagResetSetupTask.java","lineNumber":87,"sourceCode":"    Optional<String> currentVersion = internalProperties.read(SONARQUBE_CURRENT_VERSION);\n    \n    LOGGER.info(\"Runtime SonarQube version: {}, stored current: {}\",\n      runtimeVersionString, currentVersion.orElse(\"not set\"));\n\n    if (currentVersion.isEmpty()) {\n      LOGGER.info(\"Setting initial SonarQube current version to {}\", runtimeVersionString);\n      internalProperties.write(SONARQUBE_CURRENT_VERSION, runtimeVersionString);\n      return;\n    }\n\n    try {\n      Version storedVersion = Version.parse(currentVersion.get());\n      if (isMajorOrMinorVersionChange(runtimeVersion, storedVersion)) {\n        updateCurrentVersion(runtimeVersionString);\n        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  }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/IssueFlagResetSetupTask.java#L69-L105","documentation":"IssueFlagResetSetupTask compares the SonarQube version stored in an internal property against the running version to decide whether to reset issue flags. If the stored version string cannot be parsed into a Version, this warning is logged and the stored version is overwritten with the current runtime version string, skipping the reset comparison this run.","triggerScenarios":"start() calling Version.parse(currentVersion.get()) and catching any exception — e.g. stored property is empty, non-numeric, or in an unexpected format (like '9.9-community' or garbage).","commonSituations":"Manual edits to internal properties; migration leftovers from very old SonarQube versions; corrupted INTERNAL_PROPERTIES row; environment copies where the property was set to a build string rather than a version number.","solutions":["Nothing required: the task self-heals by rewriting the property with the current runtime version.","If you need the flag reset to run correctly, fix the stored SONARQUBE_CURRENT_VERSION property to a valid x.y.z value and restart.","Verify the internal properties table isn't corrupted by checking adjacent property rows.","Ignore the warning if the version was previously invalid and this is the one-time repair."],"exampleFix":"-- before: invalid stored version\nSELECT * FROM internal_properties WHERE kee = 'SONARQUBE_CURRENT_VERSION'; -- '9.9-community'\n-- after: set a parseable version\nUPDATE internal_properties SET text_value = '9.9.0' WHERE kee = 'SONARQUBE_CURRENT_VERSION';","handlingStrategy":"validation","validationCode":"const VERSION_RE = /^\\d+(\\.\\d+){0,2}$/;\nif (!VERSION_RE.test(storedVersion)) {\n  console.warn('Stored version invalid, will be overwritten:', storedVersion);\n}","typeGuard":"function isParsableVersion(s) {\n  return typeof s === 'string' && /^\\d+(\\.\\d+){0,2}$/.test(s.trim());\n}","tryCatchPattern":"try {\n  const v = parseVersion(stored);\n} catch (e) {\n  logger.warn('Unable to parse stored version, resetting to current', e);\n  writeCurrentVersion(runtime);\n}","preventionTips":["Never hand-edit internal_properties version rows","Always upgrade through supported SonarQube versions","Keep version strings in plain x.y.z form","Back up the DB before migrations so malformed values can be restored"],"tags":["version-parsing","startup","migration","self-healing"],"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"}