{"record":{"id":"0f15751a79225962","repo":"quarkusio/quarkus","slug":"could-not-expand-value-s-in-property-s","errorCode":null,"errorMessage":"Could not expand value %s in property %s","messagePattern":"Could not expand value (.+?) in property (.+?)","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"extensions/scheduler/common/src/main/java/io/quarkus/scheduler/common/runtime/util/SchedulerUtils.java","lineNumber":161,"sourceCode":"        return val;\n    }\n\n    /**\n     * Adapted from {@link io.smallrye.config.ExpressionConfigSourceInterceptor}\n     */\n    private static String resolvePropertyExpression(String expr) {\n        final Config config = ConfigProvider.getConfig();\n        final Expression expression = Expression.compile(expr, LENIENT_SYNTAX, NO_TRIM);\n        final String expanded = expression.evaluate(new BiConsumer<ResolveContext<RuntimeException>, StringBuilder>() {\n            @Override\n            public void accept(ResolveContext<RuntimeException> resolveContext, StringBuilder stringBuilder) {\n                final Optional<String> resolve = config.getOptionalValue(resolveContext.getKey(), String.class);\n                if (resolve.isPresent()) {\n                    stringBuilder.append(resolve.get());\n                } else if (resolveContext.hasDefault()) {\n                    resolveContext.expandDefault();\n                } else {\n                    throw new NoSuchElementException(String.format(\"Could not expand value %s in property %s\",\n                            resolveContext.getKey(), expr));\n                }\n            }\n        });\n        return expanded;\n    }\n\n    private static boolean isConfigExpression(String val) {\n        if (val == null) {\n            return false;\n        }\n        int exprStart = val.indexOf(\"${\");\n        int exprEnd = -1;\n        if (exprStart >= 0) {\n            exprEnd = val.indexOf('}', exprStart + 2);\n        }\n        return exprEnd > 0;\n    }","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/scheduler/common/src/main/java/io/quarkus/scheduler/common/runtime/util/SchedulerUtils.java#L143-L179","documentation":"When expanding property placeholders inside @Scheduled schedule expressions, SchedulerUtils installs a SmallRye Config interceptor that resolves each referenced property. If the property cannot be resolved from config and has no default value, expansion fails with this NoSuchElementException naming the property key and expression.","triggerScenarios":"A @Scheduled attribute (cron/every/delayed) references a config property (e.g. ${my.cron}) that is not present in application.properties / env / config sources and has no default.","commonSituations":"Typo in the property name; property defined only in another profile (e.g. %prod) while running in dev; property removed after a version upgrade; forgetting to set the env var that backs the property.","solutions":["Define the missing property in application.properties or via an environment variable","Provide an inline default in the expression, e.g. ${my.cron:0 0 * * * ?}","Check the active Quarkus profile — the property may exist only under another profile","Search for the exact key referenced by the schedule expression and fix typos"],"exampleFix":"// before\n@Scheduled(cron = \"{app.cron}\")\n// after (with default)\n@Scheduled(cron = \"{app.cron:0/30 * * * * ?}\")\n// or add to application.properties:\n// app.cron=0/30 * * * * ?","handlingStrategy":"validation","validationCode":"Optional<String> v = ConfigProvider.getConfig().getOptionalValue(\"app.cron\", String.class);\nif (v.isEmpty()) throw new IllegalStateException(\"app.cron must be set for the schedule\");","typeGuard":null,"tryCatchPattern":"try { String cron = config.getValue(\"app.cron\", String.class); }\ncatch (NoSuchElementException e) { /* supply default or fail fast with clear message */ }","preventionTips":["Provide defaults in property expressions: ${key:defaultValue}","Set required properties for every active Quarkus profile","Validate config at startup with @ConfigMapping and mandatory keys","Keep property names consistent between code and application.properties"],"tags":["scheduler","config","property-expansion","quarkus"],"backgroundTag":"missing-config-property","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}