quarkusio/quarkus · error · IllegalArgumentException

Unknown naming strategy provided: ${strategy.substringAfter

Error message

Unknown naming strategy provided:  ${strategy.substringAfter('.')}

What it means

Thrown by JsonProducer.extractBuiltIn when the configured naming-strategy value looks like a built-in (dotted) reference but no matching property exists on JsonNamingStrategy.Builtins. The strategy string's suffix after the last '.' is matched against Builtins member properties; an unmatched suffix means the strategy name is misspelled or unsupported.

Source

Thrown at extensions/resteasy-reactive/rest-kotlin-serialization-common/runtime/src/main/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/runtime/JsonProducer.kt:103

                        "No no-arg constructor found on $strategy"
                    )
            return constructor.newInstance() as JsonNamingStrategy
        } catch (e: ReflectiveOperationException) {
            throw IllegalArgumentException(
                "Error loading naming strategy:  ${strategy.substringAfter('.')}",
                e,
            )
        }
    }

    @ExperimentalSerializationApi
    private fun extractBuiltIn(strategy: String): JsonNamingStrategy {
        val kClass = Builtins::class
        val property =
            kClass.memberProperties.find { property ->
                property.name == strategy.substringAfter('.')
            }
                ?: throw IllegalArgumentException(
                    "Unknown naming strategy provided:  ${strategy.substringAfter('.')}"
                )

        return property.get(JsonNamingStrategy) as JsonNamingStrategy
    }

    private fun sortCustomizersInDescendingPriorityOrder(
        customizers: Iterable<JsonBuilderCustomizer>
    ): List<JsonBuilderCustomizer> {
        val sortedCustomizers: MutableList<JsonBuilderCustomizer> = ArrayList()
        for (customizer in customizers) {
            sortedCustomizers.add(customizer)
        }
        sortedCustomizers.sort()
        return sortedCustomizers
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use the exact Builtins property name, e.g. kotlinx.serialization.json.JsonNamingStrategy.snake_case.
  2. List available names from JsonNamingStrategy.Builtins in the kotlinx.serialization docs and correct the value.
  3. To define a custom strategy, implement JsonNamingStrategy and configure a custom class instead of a Builtins name.

Example fix

// before
quarkus.rest.kotlin-serialization.naming-strategy=kotlinx.serialization.json.JsonNamingStrategy.SnakeCase
// after
quarkus.rest.kotlin-serialization.naming-strategy=kotlinx.serialization.json.JsonNamingStrategy.snake_case
Defensive patterns

Strategy: validation

Validate before calling

val builtins = JsonNamingStrategy.Builtins::class.memberProperties.map { it.name }
val name = strategy.substringAfter('.')
require(name in builtins) { "$name not one of $builtins" }

Try / catch

try { /* start app with strategy */ } catch (e: IllegalArgumentException) { logger.error("Bad naming strategy: ${e.message}"); throw e }

Prevention

When it happens

Trigger: quarkus.rest.kotlin-serialization.naming-strategy set to something like kotlinx.serialization.json.JsonNamingStrategy.SnakeCase (capitalized) or any name that is not exactly one of Builtins' members (snake_case, kebab-case, pascal_case, lower_case, etc.).

Common situations: Camel-case vs snake-case confusion (snakeCase vs snake_case); copying a strategy name from a Jackson docs page; typos.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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