SonarSource/sonarqube · warning

Unable to parse stored version

Error message

Unable to parse stored version '{}', updating to current version '{}'

What it means

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.

Solutions

  1. Nothing required: the task self-heals by rewriting the property with the current runtime version.
  2. 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.
  3. Verify the internal properties table isn't corrupted by checking adjacent property rows.
  4. Ignore the warning if the version was previously invalid and this is the one-time repair.

Example fix

-- before: invalid stored version
SELECT * FROM internal_properties WHERE kee = 'SONARQUBE_CURRENT_VERSION'; -- '9.9-community'
-- after: set a parseable version
UPDATE internal_properties SET text_value = '9.9.0' WHERE kee = 'SONARQUBE_CURRENT_VERSION';
Defensive patterns

Strategy: validation

Validate before calling

const VERSION_RE = /^\d+(\.\d+){0,2}$/;
if (!VERSION_RE.test(storedVersion)) {
  console.warn('Stored version invalid, will be overwritten:', storedVersion);
}

Type guard

function isParsableVersion(s) {
  return typeof s === 'string' && /^\d+(\.\d+){0,2}$/.test(s.trim());
}

Try / catch

try {
  const v = parseVersion(stored);
} catch (e) {
  logger.warn('Unable to parse stored version, resetting to current', e);
  writeCurrentVersion(runtime);
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/fc6ecc39d4be16f2. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-core/src/main/java/org/sonar/server/startup/IssueFlagResetSetupTask.java:87

    Optional<String> currentVersion = internalProperties.read(SONARQUBE_CURRENT_VERSION);
    
    LOGGER.info("Runtime SonarQube version: {}, stored current: {}",
      runtimeVersionString, currentVersion.orElse("not set"));

    if (currentVersion.isEmpty()) {
      LOGGER.info("Setting initial SonarQube current version to {}", runtimeVersionString);
      internalProperties.write(SONARQUBE_CURRENT_VERSION, runtimeVersionString);
      return;
    }

    try {
      Version storedVersion = Version.parse(currentVersion.get());
      if (isMajorOrMinorVersionChange(runtimeVersion, storedVersion)) {
        updateCurrentVersion(runtimeVersionString);
        resetFromSonarQubeUpdateFlag();
      }
    } catch (Exception e) {
      LOGGER.warn("Unable to parse stored version '{}', updating to current version '{}'", 
        currentVersion.get(), runtimeVersionString, e);
      updateCurrentVersion(runtimeVersionString);
    }
  }

  private static boolean isMajorOrMinorVersionChange(Version newVersion, Version oldVersion) {
    try {
      int newMajor = newVersion.major();
      int newMinor = newVersion.minor();
      int oldMajor = oldVersion.major();
      int oldMinor = oldVersion.minor();
      
      return newMajor != oldMajor || newMinor != oldMinor;
    } catch (Exception e) {
      LOGGER.warn("Unable to parse version numbers for major/minor comparison: old='{}', new='{}'", oldVersion, newVersion, e);
      return false;
    }
  }

View on GitHub (pinned to 184c821202)