quarkusio/quarkus · error · IllegalArgumentException

Invalid '<paramName>String' value "<value>" - cannot parse i

Error message

Invalid '<paramName>String' value "<value>" - cannot parse into long

What it means

A *String attribute of Spring's @Scheduled (e.g. fixedRateString) must resolve to text parseable as a long after optional property-placeholder lookup. The processor parses it at build time with Long.valueOf and throws when the value is not a plain number.

Source

Thrown at extensions/spring-scheduled/deployment/src/main/java/io/quarkus/spring/scheduled/deployment/SpringScheduledProcessor.java:173

        } else { //param value as String e.g. a placeholder ${value.from.conf} or java.time.Duration compliant value
            paramValueString = getAnnotationValueByName(springAnnotationValues, paramName + "String")
                    .get().asString();
            paramValue = valueOf(paramName, paramValueString);

        }
        return paramValue;
    }

    private long valueOf(String paramName, String paramValueString) {
        long paramValue;
        if (paramValueString.startsWith("${")) {
            paramValueString = paramValueString.replace("${", "{").trim();
            paramValueString = SchedulerUtils.lookUpPropertyValue(paramValueString);
        }
        try {
            paramValue = Long.valueOf(paramValueString);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                    "Invalid '" + paramName + "String' value \"" + paramValueString + "\" - cannot parse into long");
        }
        return paramValue;
    }

    private boolean annotationsValuesContain(List<AnnotationValue> springAnnotationValues, String valueName) {
        return springAnnotationValues.stream().filter(spv -> spv.name().equals(valueName)).findAny().isPresent();
    }

    private Optional<AnnotationValue> getAnnotationValueByName(List<AnnotationValue> springAnnotationValues, String valueName) {
        return springAnnotationValues.stream().filter(spv -> spv.name().equals(valueName)).findAny();
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set the referenced property to a plain numeric value (e.g. my.rate=5000) in application.properties
  2. Replace the *String attribute with a numeric literal (fixedRate = 5000)
  3. Convert the value to milliseconds and remove unit suffixes
  4. Verify the placeholder can be resolved at build time (avoid runtime-only config sources)

Example fix

// before
@Scheduled(fixedRateString = "${job.rate}") // job.rate not set
void run() {}

// after (application.properties: job.rate=5000)
@Scheduled(fixedRateString = "${job.rate}")
void run() {}
Defensive patterns

Strategy: validation

Validate before calling

String raw = "${job.rate}";
String resolved = resolveProperty(raw); // from application.properties
try {
    Long.parseLong(resolved);
} catch (NumberFormatException e) {
    throw new IllegalStateException("@Scheduled *String value must be a long: " + resolved);
}

Prevention

When it happens

Trigger: @Scheduled(fixedRateString = "abc") or fixedRateString = "${my.rate}" where the property is missing (placeholder fails to resolve) or its value is not a plain long (e.g. "5s", "PT5S").

Common situations: Config property not set in application.properties so the placeholder cannot be resolved; duration strings with time units; typos in the value.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/4380548a497f2bb1. Report an issue: GitHub.